daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jul 21st, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #if = true
  2.  then
  3. #FUK UR MOM! THIS DIDNT WORK!!!!!
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <time.h>
  7.  
  8. #define mystr "My own utility. Copyright (C) 2007-2010 hpgl, Russia"
  9.  
  10. #define allow595B
  11. #define allowA95B
  12. #define allow2A7B
  13.  
  14. #define fSVCTAG 0
  15. #define fHDDSN 1
  16. #define fHDDold 2
  17. #define t595B 0
  18. #define tD35B 1
  19. #define tA95B 2
  20. #define t2A7B 3
  21.  
  22. #ifdef allow595B
  23. #define f595B
  24. #endif
  25. #ifdef allowA95B
  26. #define f595B
  27. #endif
  28. #ifdef allow2A7B
  29. #endif
  30.  
  31. char bSuffix[]="595BD35BA95B2A7B";
  32.  
  33. char scancods[]="\00\0331234567890-=\010\011qwertyuiop[]\015\377asdfghjkl;'`\377\\zxcvbnm,./";
  34. char encscans[]={0x05,0x10,0x13,0x09,0x32,0x03,0x25,0x11,0x1F,0x17,0x06,0x15, \
  35.                  0x30,0x19,0x26,0x22,0x0A,0x02,0x2C,0x2F,0x16,0x14,0x07,0x18, \
  36.                  0x24,0x23,0x31,0x20,0x1E,0x08,0x2D,0x21,0x04,0x0B,0x12,0x2E};
  37.  
  38. #ifdef allow2A7B
  39. char chartabl2A7B[72]="012345679abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0";
  40. #endif
  41.  
  42. unsigned int MD5magic[64]={
  43. 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
  44. 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
  45. 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
  46. 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
  47. 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
  48. 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
  49. 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
  50. 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
  51. 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
  52. 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
  53. 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05,
  54. 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
  55. 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
  56. 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
  57. 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
  58. 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391};
  59.  
  60. unsigned char inData[23],outData[16];
  61. char buf1output[32], buf1input[20];
  62. char bug4;
  63.  
  64. void calcsuffix(char bfunc, char btype, char *outbuf);
  65.  
  66. void initData(void) {
  67.     *(int *)(&outData[0]) =0x67452301;
  68.     *(int *)(&outData[4]) =0xEFCDAB89;
  69.     *(int *)(&outData[8]) =0x98BADCFE;
  70.     *(int *)(&outData[12])=0x10325476;
  71. }
  72.  
  73. typedef int (encfuncT1) (int num1, int num2, int num3);
  74.  
  75. #ifdef f595B
  76. int enc0F2(int num1, int num2, int num3) {return (((~num3 ^ num2) & num1) ^ ~num3);}
  77. int enc0F4(int num1, int num2, int num3) {return (( ~num2 ^ num1) ^ num3); }
  78. int enc0F5(int num1, int num2, int num3) {return (( ~num1 | ~num3) ^ num2); }
  79. #endif
  80. int enc1F2(int num1, int num2, int num3) {return ((( num3 ^ num2) & num1) ^ num3);}
  81. int enc1F4(int num1, int num2, int num3) {return (( num2 ^ num1) ^ num3); }
  82. int enc1F5(int num1, int num2, int num3) {return (( num1 | ~num3) ^ num2); }
  83. int encF3 (int num1, int num2, int num3) {return ((( num1 ^ num2) & num3) ^ num2);}
  84.  
  85. typedef int (encfuncT2)(encfuncT1 func, int num1, int num2, int num3, int key);
  86.  
  87. int enc1F1 (encfuncT1 func, int num1, int num2, int num3, int key)
  88. {
  89.     return func(num1,num2,num3)+key;
  90. }
  91.  
  92. #ifdef f595B
  93. int enc0F1 (encfuncT1 func, int num1, int num2, int num3, int key)
  94. {
  95.     return func(num1,num2,num3)-key;
  96. }
  97. #endif
  98.  
  99. unsigned int rol(unsigned int t, int bitsrot)
  100. {
  101.     return (t >> (32-bitsrot)) | (t << bitsrot);
  102. }
  103.  
  104. void blockEncodeF(int *outdata, int *encblock, encfuncT2 func1,
  105.                   encfuncT1 func2, encfuncT1 func3, encfuncT1 func4, encfuncT1 func5 )
  106. {
  107.     char S[4][4] = {{ 7, 12, 17, 22 },{ 5, 9, 14, 20 },{ 4, 11, 16, 23 },{ 6, 10, 15, 21 }};
  108.     int A,B,C,D,t,i;
  109.  
  110.     A=outdata[0];
  111.     B=outdata[1];
  112.     C=outdata[2];
  113.     D=outdata[3];
  114.  
  115.     for (i=0;i<64;i++) {
  116.         t=MD5magic[i];
  117.         switch (i>>4) {
  118.             case 0: t=A+func1(func2,B,C,D, t+encblock[(i) & 15]); break;
  119.             case 1: t=A+func1(func3,B,C,D, t+encblock[(i*5+1) & 15]); break;
  120.             case 2: t=A+func1(func4,B,C,D, t+encblock[(i*3+5) & 15]); break;
  121.             case 3: t=A+func1(func5,B,C,D, t+encblock[(i*7) & 15]); break;
  122.         }
  123.         A=D; D=C; C=B; B+=rol(t,S[i>>4][i&3]);
  124.     };
  125.  
  126.     outdata[0]+=A;
  127.     outdata[1]+=B;
  128.     outdata[2]+=C;
  129.     outdata[3]+=D;
  130. }
  131.  
  132. void blockEncode(char *outdata, int *encblock, char btype) {
  133.     if (btype==tD35B)
  134.         blockEncodeF((int *)outdata,encblock,enc1F1,enc1F2,encF3,enc1F4,enc1F5);
  135. #ifdef f595B
  136.     else
  137.         blockEncodeF((int *)outdata,encblock,enc0F1,enc0F2,encF3,enc0F4,enc0F5);
  138. #endif
  139. }
  140.  
  141. void encode(char *inbuf,int cnt,char btype) {
  142.     int encBlock[16];
  143.     char *ptr;
  144.     initData();
  145.     memcpy(encBlock,inbuf,cnt);
  146.     ptr=&((char *)encBlock)[cnt];
  147.     *ptr++=0x80;
  148.     memset(ptr,0,64-1-cnt);
  149.     encBlock[16-2]=((unsigned int)cnt << 3);
  150.     blockEncode(outData,encBlock,btype);
  151. }
  152.  
  153. void psw(char bfunc, char btype, char *outbuf) {
  154.     int cnt,lenpsw,r;
  155.     if (bfunc==fHDDold) {
  156.         memcpy(inData,buf1input,11);
  157.         calcsuffix(bfunc,btype,outbuf);
  158.         for (cnt=0;cnt<8;cnt++)
  159.             outbuf[cnt]= scancods[ outbuf[cnt] ];
  160.     } else {
  161.         memset(inData,0,sizeof(inData));
  162.  
  163.         if (bfunc==fSVCTAG) cnt=7;
  164.         else cnt=11;
  165.  
  166.         if ((bfunc==fHDDSN) && (btype==tA95B))
  167.             memcpy(inData,&buf1input[3],cnt-3);
  168.         else
  169.             memcpy(inData,buf1input,cnt);
  170.  
  171.         if (btype==t595B) memcpy(&inData[cnt],&bSuffix[0],4); else
  172.         if (btype==tD35B) memcpy(&inData[cnt],&bSuffix[4],4); else
  173.         if (btype==tA95B) memcpy(&inData[cnt],&bSuffix[0],4); else
  174.         if (btype==t2A7B) memcpy(&inData[cnt],&bSuffix[12],4);
  175.         calcsuffix(bfunc,btype,outbuf);
  176.         memcpy(&inData[cnt+4],outbuf,8);
  177.         encode(inData,23,btype);
  178.         r = outData[0] % 9;
  179.         lenpsw = 0;
  180.         for (cnt=0;cnt<16;cnt++) {
  181.             if ((r <= cnt) && (lenpsw<8)) {
  182.                 buf1output[lenpsw++] = scancods[encscans[outData[cnt] % sizeof(encscans)]];
  183.             }
  184.         }
  185.     }
  186. }
  187.  
  188.  
  189. void calcsuffix(char bfunc, char btype, char* outbuf) {
  190.     int i,r;
  191.     if (bfunc==fSVCTAG) {
  192.         outbuf[0] = inData[4];
  193.         outbuf[1] = (inData[4] >> 5) | (((inData[3] >> 5) | (inData[3] << 3)) & 0xF1);
  194.         outbuf[2] = (inData[3] >> 2);
  195.         outbuf[3] = (inData[3] >> 7) | (inData[2] << 1);
  196.         outbuf[4] = (inData[2] >> 4) | (inData[1] << 4);
  197.     } else if (bfunc==fHDDSN) {
  198.         outbuf[0] = inData[8];
  199.         outbuf[1] = (inData[8] >> 5) | (((inData[9] >> 5) | (inData[9] << 3)) & 0xF1);
  200.         outbuf[2] = (inData[9] >> 2);
  201.         outbuf[3] = (inData[9] >> 7) | (inData[10] << 1);
  202.         outbuf[4] = (inData[10] >> 4) | (inData[1] << 4);
  203.     }
  204.     outbuf[5] = (inData[1] >> 1);
  205.     outbuf[6] = (inData[1] >> 6) | (inData[0] << 2);
  206.     outbuf[7] = (inData[0] >> 3);
  207.     for (i=0;i<8;i++) {
  208.         r = 0xAA;
  209.         if (outbuf[i] & 1)
  210.             if (bfunc==fHDDSN) r ^= inData[8];
  211.             else if (bfunc==fSVCTAG) r ^= inData[4];
  212.         if (outbuf[i] & 2)
  213.             if (bfunc==fHDDSN) r ^= inData[9];
  214.             else if (bfunc==fSVCTAG) r ^= inData[3];
  215.         if (outbuf[i] & 4)
  216.             if (bfunc==fHDDSN) r ^= inData[10];
  217.             else if (bfunc==fSVCTAG) r ^= inData[2];
  218.         if (outbuf[i] & 8)
  219.             r ^= inData[1];
  220.         if (outbuf[i] & 16)
  221.             r ^= inData[0];
  222.         outbuf[i] = encscans[r % sizeof(encscans)];
  223.     }
  224. }
  225.  
  226. int main(int argc, char *argv[]) {
  227.     unsigned char len,len1,bfunc,eol=1,echo=0, *minus,s2[20];
  228.     signed char btype; int argn=0;
  229.  
  230.     if (argc>1)
  231.         echo=1;
  232.  
  233.     if (!echo)
  234.         fputs("" mystr "\n" \
  235.           "Short service tag should be right padded with '*' up to length 7 chars\n" \
  236.           "HDD serial number is right 11 chars from real HDDSerNum left padded with '*'\n" \
  237.           "Some BIOSes has left pad HDD serial number with spaces instead '*'\n",stdout);
  238.  
  239.     while (!feof(stdin)) {
  240.         if ((argc<=1) && argn) break;
  241.         fputs("Input: #",stdout);
  242.         if (argc>1) {
  243.             strncpy(buf1input,argv[++argn],sizeof(buf1input));argc--;
  244.         }
  245.         else {
  246.             if (!eol) while (!feof(stdin) && (fgetc(stdin)!='\n')); eol=0;
  247.             if (fgets(buf1input,16+1+1,stdin)==NULL) {
  248.                 if (echo) fputs("\n",stdout);
  249.                 break;
  250.             }
  251.         }
  252.         len=strlen(buf1input);
  253.         if (len && (buf1input[len-1]=='\n')) {len--;eol=1;buf1input[len]=0;}
  254.         if (echo) {fputs(buf1input,stdout);fputs("\n",stdout);}
  255.         minus=strchr(buf1input,'-');
  256.         if (len==11) {
  257.             if (minus!=NULL) {
  258.                 fputs("- Incorrect input\n",stdout);
  259.                 continue;
  260.             }
  261.             bfunc=fHDDold;
  262.             fputs("By HDD serial number for older BIOS: ",stdout);
  263.         } else {
  264.             if (len==0) break;
  265.             if (minus==NULL) {
  266.                 fputs("- No BIOS type found in input string, must be followed by -595B and other registered\n",stdout);
  267.                 continue;
  268.             }
  269.             len1=minus-(unsigned char*)buf1input;
  270.  
  271.             btype=-1;
  272. #ifdef allow595B
  273.             if (strncmp(&buf1input[len1+1],&bSuffix[0],4)==0) btype=t595B;
  274.             else
  275. #endif
  276.             if (strncmp(&buf1input[len1+1],&bSuffix[4],4)==0) btype=tD35B;
  277.             else
  278. #ifdef allowA95B
  279.             if (strncmp(&buf1input[len1+1],&bSuffix[8],4)==0) btype=tA95B;
  280.             else
  281. #endif
  282. #ifdef allow2A7B
  283.             if (strncmp(&buf1input[len1+1],&bSuffix[12],4)==0) btype=t2A7B;
  284. #endif
  285.             if (btype<0) {
  286.                 fputs("- Invalid service tag in input string, allowed only -D35B and other registered\n",stdout);
  287.                 continue;
  288.             }
  289.             struct tm *time1; time_t timer1=time(NULL);
  290.             time1=gmtime(&timer1);
  291.             strftime(s2,sizeof(s2),"%d.%m.%Y %H:%M",time1);
  292.             fputs(s2,stdout);
  293.             fputs(" DELL ",stdout);
  294.  
  295.             if (len1==7) {
  296.                 bfunc=fSVCTAG;
  297.                 fputs("service tag: ",stdout);
  298.                 fputs(buf1input,stdout);
  299.             } else
  300.             if (len1==11) {
  301.                 bfunc=fHDDSN;
  302.                 fputs("HDD serial number: ",stdout);
  303.                 fputs(buf1input,stdout);
  304.             }
  305.             else {
  306.                 fputs("- Incorrect input, must be 7 chars service tag or 11 chars HDD serial number\n",stdout);
  307.                 continue;
  308.             }
  309.         }
  310.         psw(bfunc,btype,buf1output);
  311.         fputs(" password: ",stdout);
  312.         fputs(buf1output,stdout);
  313.         if (bug4) fputs(" !bug4 warning - password may not work!",stdout);
  314.  
  315.         if (btype==t595B) if (bfunc==fSVCTAG) { //to check if A95B bug
  316.             char mpw1[20];
  317.             strcpy(mpw1,buf1output);
  318.             psw(bfunc,tA95B,buf1output);
  319.             if (strcmp(mpw1,buf1output)!=0) {
  320.                 fputs(" passwordA95B: ",stdout);
  321.                 fputs(buf1output,stdout);
  322.             }
  323.         }
  324.         fputs("\n",stdout);
  325.     }
  326.     return 0;
  327. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top