Bitcoin Forum
May 13, 2024, 03:05:47 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Vanitygen Ouptut to csv?  (Read 2194 times)
SodaWarz (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
September 29, 2014, 10:30:04 PM
 #1

Hey guys,

quite some months back i found a link somewhere to a version of vanitygen that output .csv format instead of .txt it looked something like

address,privkey
address,privkey
address,privkey

instead of the

pattern: XXXXXX
Address:XXXXXXXXXXXXXXXXXXXXXXX
Privkey:XXXXXXXXXXXXXXXXXXXXXXXXX

I cannot seem to find that link again after a hard drive crash after a few days of scouring the web. I have found a few code sources for it but none of them in the same .csv format as the one i had found a few months ago.


Does anyone still have the link? or a copy of the software i can grab from them?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
SodaWarz (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
September 30, 2014, 03:08:29 PM
 #2

Nobody? Really? Did the whole community run away because a slight drop in price?
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
September 30, 2014, 06:43:48 PM
 #3

Do you plan on compiling vanitygen yourself? If so, the changes should be trivial and obvious. In https://github.com/samr7/vanitygen/blob/master/keyconv.c:

Code:
if (generate) {
unsigned char *pend = (unsigned char *) pbuf;
addrtype = 0;
privtype = 128;
EC_KEY_generate_key(pkey);
res = i2o_ECPublicKey(pkey, &pend);
fprintf(stderr, "Pubkey (hex): ");
dumphex((unsigned char *)pbuf, res);
fprintf(stderr, "Privkey (hex): ");
dumpbn(EC_KEY_get0_private_key(pkey));
vg_encode_address(EC_KEY_get0_public_key(pkey),
EC_KEY_get0_group(pkey),
addrtype, ecprot);
printf("Address: %s\n", ecprot);
vg_encode_privkey(pkey, privtype, ecprot);
printf("Privkey: %s\n", ecprot);
return 0;
}

I would not recommend running any compiled executable randomly found on the internet for such a minor change.

You can also just use a text editor with search-and-replace and format the output file yourself.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
September 30, 2014, 11:07:08 PM
 #4

Do you plan on compiling vanitygen yourself? If so, the changes should be trivial and obvious. In https://github.com/samr7/vanitygen/blob/master/keyconv.c:

Code:
if (generate) {
unsigned char *pend = (unsigned char *) pbuf;
addrtype = 0;
privtype = 128;
EC_KEY_generate_key(pkey);
res = i2o_ECPublicKey(pkey, &pend);
fprintf(stderr, "Pubkey (hex): ");
dumphex((unsigned char *)pbuf, res);
fprintf(stderr, "Privkey (hex): ");
dumpbn(EC_KEY_get0_private_key(pkey));
vg_encode_address(EC_KEY_get0_public_key(pkey),
EC_KEY_get0_group(pkey),
addrtype, ecprot);
printf("Address: %s\n", ecprot);
vg_encode_privkey(pkey, privtype, ecprot);
printf("Privkey: %s\n", ecprot);
return 0;
}

I would not recommend running any compiled executable randomly found on the internet for such a minor change.

You can also just use a text editor with search-and-replace and format the output file yourself.
Well you wouldn't really find an executable like that randomly Cheesy.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
SodaWarz (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
October 01, 2014, 03:03:15 PM
 #5

Do you plan on compiling vanitygen yourself? If so, the changes should be trivial and obvious. In https://github.com/samr7/vanitygen/blob/master/keyconv.c:

Code:
if (generate) {
unsigned char *pend = (unsigned char *) pbuf;
addrtype = 0;
privtype = 128;
EC_KEY_generate_key(pkey);
res = i2o_ECPublicKey(pkey, &pend);
fprintf(stderr, "Pubkey (hex): ");
dumphex((unsigned char *)pbuf, res);
fprintf(stderr, "Privkey (hex): ");
dumpbn(EC_KEY_get0_private_key(pkey));
vg_encode_address(EC_KEY_get0_public_key(pkey),
EC_KEY_get0_group(pkey),
addrtype, ecprot);
printf("Address: %s\n", ecprot);
vg_encode_privkey(pkey, privtype, ecprot);
printf("Privkey: %s\n", ecprot);
return 0;
}

I would not recommend running any compiled executable randomly found on the internet for such a minor change.

You can also just use a text editor with search-and-replace and format the output file yourself.

I can compile it myself into a .exe but when it comes to C code i know nothing other than how to build a program using a makefile using nmake.

To be honest i tried just re-creating Vanitygen in Java as that is the only language i know enough to hobble my way through coding, but in Java i was lucky to get 20-30 addresses a second which would take me years to find a simple 1boat address.

I have found several (replace this with THIS) modifications for a .csv output form vanitygen. Just none of them with the Address,Key format.
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
October 01, 2014, 06:11:20 PM
 #6

Here is what the file output looks like from vanitygen:

Pattern: 1ABCD
Address: 1ABCDiVXy67iuRfYYcFouxAWFnjccwgTD1
Privkey: 5JHTbQGS2ZbVQPaWwprMyVCxSrD38tcboKt2QEXj9ABnv3KfzhN

In c, fprintf() is the function for writing to a file. We only need to look for the lines that use the file-write function to make these particular lines in the output file, and modify them.

Change each code line so that it prints what we want in CSV format? pattern.c appears to have all the code needed to change the file output option (not modify the console output).

In pattern.c, we find the file output code starting at line 584:


   if (vcp->vc_result_file) {
      FILE *fp = fopen(vcp->vc_result_file, "a");
      if (!fp) {
         fprintf(stderr,
            "ERROR: could not open result file: %s\n",
            strerror(errno));
      } else {
         fprintf(fp,
            "Pattern: %s\n"
            , pattern);

         if (isscript)
            fprintf(fp, "P2SHAddress: %s\n", addr2_buf);
         fprintf(fp,
            "Address: %s\n"
            "%s: %s\n",
            addr_buf, keytype, privkey_buf);

         fclose(fp);
      }
   }
   if (free_ppnt)
      EC_POINT_free(ppnt);
}



#1: suppress the "pattern" output in pattern.c

Replace the red stuff with:

         ; // don't print pattern

#2: remove the "address" and "privkey" text, and remove the carriage-return between the two lines.

Replace the blue stuff with:

         fprintf(fp,
            "%s, %s\n",
            addr_buf, privkey_buf);


You need to turn in your geek card if you can't figure out what the code here is doing.
SodaWarz (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
October 01, 2014, 06:18:14 PM
 #7

Here is what the file output looks like from vanitygen:

Pattern: 1ABCD
Address: 1ABCDiVXy67iuRfYYcFouxAWFnjccwgTD1
Privkey: 5JHTbQGS2ZbVQPaWwprMyVCxSrD38tcboKt2QEXj9ABnv3KfzhN

In c, fprintf() is the function for writing to a file. We only need to look for the lines that use the file-write function to make these particular lines in the output file, and modify them.

Change each code line so that it prints what we want in CSV format? pattern.c appears to have all the code needed to change the file output option (not modify the console output).

In pattern.c, we find the file output code starting at line 584:


   if (vcp->vc_result_file) {
      FILE *fp = fopen(vcp->vc_result_file, "a");
      if (!fp) {
         fprintf(stderr,
            "ERROR: could not open result file: %s\n",
            strerror(errno));
      } else {
         fprintf(fp,
            "Pattern: %s\n"
            , pattern);

         if (isscript)
            fprintf(fp, "P2SHAddress: %s\n", addr2_buf);
         fprintf(fp,
            "Address: %s\n"
            "%s: %s\n",
            addr_buf, keytype, privkey_buf);

         fclose(fp);
      }
   }
   if (free_ppnt)
      EC_POINT_free(ppnt);
}



#1: suppress the "pattern" output in pattern.c

Replace the red stuff with:

         ; // don't print pattern

#2: remove the "address" and "privkey" text, and remove the carriage-return between the two lines.

Replace the blue stuff with:

         fprintf(fp,
            "%s, %s\n",
            addr_buf, privkey_buf);


You need to turn in your geek card if you can't figure out what the code here is doing.


AMAZING AND THANK YOU 1,000 TIMES OVER.
Loco
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
October 03, 2014, 05:27:24 PM
 #8

i used Control+F to search for each "fprintf" in the text, but im not sure which one of the 10 lines i found i should replace.
Sorry to bother but i would apreciate if someone told me which lines to replace. ( I already did the 584 line )
Thanks a lot
SodaWarz (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
October 16, 2014, 10:30:20 PM
 #9

Could someone try compiling this for windows for me to test?

I have tried it a dozen times and get nothing but dll error after dll error when i try to run it
gwlloyd
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
October 17, 2014, 07:06:34 PM
 #10

If you're having trouble editing the source then you could use the default source and just have a simple script to parse the output into a CSV. There are a million ways to do it but as an example the PHP below will extract the Address & Private Key from the standard vanitygen output.. you might need to edit it a bit as I don't use Windows but if you know a bit of Java then you'll be able to pluck out the data in the same way with that by capturing the output and parsing the relevant lines.


Code:


        exec($vanityGenLocation.' -i 1test 2>&1', $rawData);

        $parsedData['Address'] = substr($rawData[2], 9);
        $parsedData['PrivKey'] = substr($rawData[3], 9);


Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!