Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Used IP addresses

Name: Anonymous 2009-03-02 18:05

Anyone got some C code that loops over all used IP addresses?  Can you come up with any special optimizations?  (I need to handle them in the "%u.%u.%u.%u"-form; computations are independant and can be run in parallel)

Name: Anonymous 2009-03-02 18:08


for(i = 0; i < 256; i++)
  for(h = 0; h < 256; h++)
    for(j = 0; j < 256; j++)
      for(k = 0; k < 256; k++)
        printf("%d.%d.%d.%d",i,h,j,k);

Name: Anonymous 2009-03-02 18:25



/*
EXPERT C CODING
*/



#include <stdio.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <limits.h>

int main(int argc, char **argv) {

  uint32_t ip = 0, ipn;
  unsigned char *p = (unsigned char*)&ipn;
  while(1) {
    ipn = htonl(ip);
    printf("%d.%d.%d.%d\n",p[0],p[1],p[2],p[3]);
    if(ip++==UINT_MAX)
      break;
  }

  return 0;
}

Name: Anonymous 2009-03-02 18:37

>>2
yo dawg, we heard u like iteration, so we put a for loop in ur for loop so u can iterate while u iterate

Name: Anonymous 2009-03-02 20:09

>>1
are you a hacker?

Name: Anonymous 2009-03-02 20:22

[foldr1 ((++).(++".")) $ map show [a,b,c,d] | a <- [0..255], b <- [0..255], c <- [0..255], d <- [0..255]]

Name: Anonymous 2009-03-02 20:23

    for(i = 0; i < 256; i++)
      for(h = 0; h < 256; h++)
        for(j = 0; b < 256; j++)
          for(k = 0; t < 256; k++)
            printf("%d.%d.%d.%d",i,h,b,t);

Name: Anonymous 2009-03-02 20:26

Have you read your poignant guide today?
256.times{|i|256.times{|j|256.times{|k|256.times{|l|puts "#{i}.#{j}.#{k}.#{l}"}}}}
THIS IS SO ELEGANT FUCK I NEED TO MASTURBATE.
I've run it for an hour, currently at 1.12.90.201

Name: Anonymous 2009-03-02 20:52

[foldr1 ((++).(++".")) $ map show [a,b,c,d] | a <- [0..255], b <- [0..255], c <- [0..255], d <- [0..255]][/code
[code]map (intercalate "." . map show) . sequence . replicate 4 $ [0..255]

I came

Name: Anonymous 2009-03-02 20:52

[/code]

Name: Anonymous 2009-03-02 20:53

>>9
map (intercalate "." . map show) . sequence . replicate 4 $ [0..255]

Name: Anonymous 2009-03-02 20:54

>>9,11
<interactive>:1:5: Not in scope: `intercalate'

Name: Anonymous 2009-03-02 21:02

(2**32).times{|ip| printf("%d.%d.%d.%d\n",(ip>>24)&0xff,(ip>>16)&0xff,(ip>>8)&0xff,ip&0xff)}

Name: Anonymous 2009-03-02 21:14


(2**32).times{|ip|a=Array.new(4){|n|(ip>>(n*8))&0xff};puts a.reverse.join(".")}

Name: Anonymous 2009-03-02 21:29

uint32_t n = 1;
while (n)
    printf("%d\n", n++);

Name: Anonymous 2009-03-03 5:15

print join '.',unpack 'C4',pack N,$_ foreach 0..4294967295

Name: Anonymous 2009-03-03 5:34

Here's the code I already had, by the way:

        for (a = 58; a < 223; ++a) {
                if (a == 100) { a = 107; continue; }
                if (a == 127) continue;
                if (a == 175) { a = 177; continue; }
                if (a == 179) { a = 183; continue; }
                if (a == 185) continue;
                for (b = 0; b < 256; ++b) {
                        for (c = 0; c < 256; ++c) {
                                for (d = 1; d < 255; ++d) {
                                        SHA1_Init(&ctx);
                                        sprintf(prefix1, "%u.%u.%u.%u", a, b, c, d);
                                        SHA1_Update(&ctx, prefix1, strlen(prefix1));
                                        SHA1_Update(&ctx, prefix2, 12);
                                        SHA1_Update(&ctx, salt, 448);
                                        SHA1_Final(md, &ctx);
                                        if (memcmp(search, md, sizeof(search)) == 0)
                                                goto done;
                                }
                        }
                }
                printf("%u/8 done.\n", a);
        }

Name: Anonymous 2009-03-03 6:27

>>17
Stop reading at goto done;

Name: Anonymous 2009-03-03 6:51

All right, I made some changes (most importantly I removed the overflow so it didn't loop forever on the inner loops, and I split the sprintf into four calls).  But I'm not really sure about what IP addresses I should check.  What are those LEGACY blocks?[1]  My research has shown that they might indeed be in use.

[1] http://www.iana.org/assignments/ipv4-address-space/

Name: Anonymous 2009-03-03 6:58

>>19
Nevermind, it appears there is a section on that... I need my eyes checked I think.

Now then, I hope my algorithm is correct.

Name: Anonymous 2009-03-03 7:06

>>18

                                }
                        }
                }
                printf("%u/8 done.\n", a);
        }

Name: Anonymous 2009-03-03 7:09

>>21
Thank you, FrozenVoid.

Name: Anonymous 2009-03-03 8:30

Turned out my algorithm was wrong after all, oh well, I changed it and got OpenMP working.

The input:
/* http://dis.4chan.org/read/sci/1172747610
 * 1  Name: FrozenVoid : 2007-03-01 08:54  ID:fPuNCwa3 */


And the output:
80.230.22.238

Oh FrozenVoid, this explains everything.

Name: Anonymous 2009-03-03 8:47

>>23
JEWS

Name: Anonymous 2009-03-03 8:55

Got 80.230.70.64 from the second day[1], I'd say this pretty much confirms it.

[1] http://dis.4chan.org/read/sci/1172747610/20

Name: Anonymous 2009-03-03 12:27

>>25
JEWS

Name: Anonymous 2009-03-03 13:05

>>8
Interesting.  I've been running it 25 minutes and its at 24.209.148.240

Name: Anonymous 2009-03-03 14:12

>>23,25
What does it mean?

Name: Anonymous 2009-03-03 14:37

>>28
80.230.22.238 = IGLD-80-230-22-238.inter.net.il.
80.230.70.64  = IGLD-80-230-70-64.inter.net.il.


il is the TLD of Israel.

Name: Anonymous 2009-03-03 15:01

>>29
so FV is an arab?
JEWS don't internet.

Name: Anonymous 2009-03-03 15:02

>>30
JEWS don't internet. 
Yes they do, and they are often VERY annoying.

Name: Anonymous 2009-03-03 15:51

>>29
I suddenly feel this burning desire to become a muslim and join Hamas.

Name: Anonymous 2009-03-03 16:08

>>32
I suddenly feel this burning desire to purchase some Zion gold.

Name: Anonymous 2009-03-03 22:22

>>33-34
I suddenly feel this burning sensation when I pee.

Name: Anonymous 2009-03-03 23:35

>>35
I suddenly feel this burning vomit in small quantity in my mouth.

Name: Anonymous 2009-03-04 0:39

failure

Name: Anonymous 2009-03-04 1:03


};

Name: Anonymous 2009-03-04 1:04

>>36
Go see you're local GP and get that checked out dude, that doesn't sound wright.

Name: Anonymous 2009-03-04 2:40

Fuck used IP addresses, where can I get new ones?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List