Hitman 2

Understanding the C code in «The Black Hat» briefing video.

Hitman2 - Understanding the C code in «The Black Hat» briefing video.
Loading...

I would be surprised that this code wasn't already presented here, but i didn't find anything so…

At the end of the briefing video of this week ET, there is a C code :

#include <stdio.h> int main(int, char**a){for(char*p="25YZ;SR^2>W+%'C^,X-O?O&__V;D+ #.A3,A+ 4C,$!_.",c=a;*p;putc(c=(*p+++c&63)+32,stdout));} 

Which could be expended to:

#include <stdio.h> int main(int argc, char**a) { char *p = "25YZ;SR^2>W+%'C^,X-O?O&__V;D+ #.A3,A+ 4C,$!_."; char c = a; for(;*p;) putc(c=(*p+++c&63)+32,stdout); return 0; } 

For those of you who can't read C, here is a pseudo-code:

declare p, that is pointing the first character of string "25YZ;SR^2>W+%'C^,X-O?O&__V;D+ #.A3,A+ 4C,$!_." declare character c = first character of the first command line argument while p is pointing a character of the string: c is now equal to ((p + c) bitwise and 63) + 32 p is now pointing the next character of the string print character c at screen 

You may think that the mathematical operation is a reverse cryptographic attack on 1024 bits, or any other gibberish that the target may say. Don't be fooled, it's just some caesar/vigenere code : each letter is "shifted" to an undefinite number of letter in the alphabet, number that change for each letter depending of the previous value. The first value is therefore important (here in the code, its the value of variable c).

If we compile and run this (with gcc 47.c && ./out), we get a segfault, meaning the program tried to access something that wasn't here.

Well, that's expected: this program initialize c with the value of the first argument command line, meaning you have to give a character to the program. Let's try to give an a (with for instance gcc 47.c && ./out a), and see what the program prints:

3HA;6RF:7RE75GD;FKR53?7D3RAGFE;67RF:7R6AADR3FR3>>R5AEFES 

Well, it could be anything. You know what, let's try many possibilities !

for c in {a..z};do gcc 47.c -o out ./out $c echo " $c" done 

Which will print the code and the letter leading to it on each line:

Загрузка...
3HA;6RF:7RE75GD;FKR53?7D3RAGFE;67RF:7R6AADR3FR3>>R5AEFES a 4IB<7SG;8SF86HE<[email protected]<78SG;8S7BBES4GS4??S6BFGFT b 5JC=8TH<9TG97IF=HMT75A9F5TCIHG=89TH<[email protected]@T7CGHGU c 6KD>9UI=:UH:8JG>INU86B:G6UDJIH>9:UI=:U9DDGU6IU6AAU8DHIHV d 7LE?:VJ>;VI;9KH?JOV97C;H7VEKJI?:;VJ>;V:EEHV7JV7BBV9EIJIW e [email protected];WK?<WJ<:[email protected]:8D<[email protected];<WK?<W;FFIW8KW8CCW:FJKJX f 9NGA<[email protected]=XK=;MJALQX;9E=J9XGMLKA<[email protected]=X<GGJX9LX9DDX;GKLKY g :OHB=YMA>YL><NKBMRY<:F>K:YHNMLB=>YMA>Y=HHKY:MY:EEY<HLMLZ h ;PIC>ZNB?ZM?=OLCNSZ=;G?L;ZIONMC>?ZNB?Z>IILZ;NZ;FFZ=IMNM k >SLFA>QEB>[email protected]>@>JBO>>LRQPFAB>QEB>ALLO>>Q>>II>@LPQP^ l ?TMGB^RFC^QCASPGRW^A?KCP?^MSRQGBC^RFC^BMMP^?R^?JJ^AMQRQ_ m @[email protected]@[email protected][email protected]_BNRSR n AVOID THE SECURITY CAMERA OUTSIDE THE DOOR AT ALL COSTS! o BWPJE!UIF!TFDVSJUZ!DBNFSB!PVUTJEF!UIF!EPPS!BU!BMM!DPTUT" p CXQKF"VJG"UGEWTKV$GEQIVE$SYXWMHI$XLI$HSSV$EX$EPP$GSWXW% s FVPK'
    ZQ!(KIUMZI(W>QN)NL^")LJVNRMN)>QN)MXX)JUU)LX>* x K YSN*^RO*>OM_S^#*MKWOK*Y_^>SNO*^RO*NYY*K^*KVV*MY>^>+ y L!ZTO+_SP+^PN >T_$+NLXP>L+Z _^TOP+_SP+OZZ>+L_+LWW+NZ^_^, z

On the letter o, you get:

AVOID THE SECURITY CAMERA OUTSIDE THE DOOR AT ALL COSTS! 

Which is total nonsense, since it spotted me during the mission but i still got Silent Assassin rank, but is better than the other outputs, so let's say o was the key of the code.

Wait… Why o ?

Source: Original link


Loading...
© Post "Understanding the C code in «The Black Hat» briefing video." for game Hitman 2.


Top 10 Most Anticipated Video Games of 2020

2020 will have something to satisfy classic and modern gamers alike. To be eligible for the list, the game must be confirmed for 2020, or there should be good reason to expect its release in that year. Therefore, upcoming games with a mere announcement and no discernible release date will not be included.

Top 15 NEW Games of 2020 [FIRST HALF]

2020 has a ton to look forward to...in the video gaming world. Here are fifteen games we're looking forward to in the first half of 2020.

You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *