mirror of
https://github.com/HavocFramework/Havoc
synced 2026-06-08 11:13:29 +00:00
major refactoring. bug fixes and changede the file structures for readablility etc.
This commit is contained in:
Executable
BIN
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
long Hash( char* String )
|
||||
{
|
||||
unsigned long Hash = 5381;
|
||||
int c;
|
||||
|
||||
while (c = *String++)
|
||||
Hash = ((Hash << 5) + Hash) + c;
|
||||
|
||||
return Hash;
|
||||
}
|
||||
|
||||
void ToUpperString(char * temp) {
|
||||
// Convert to upper case
|
||||
char *s = temp;
|
||||
while (*s) {
|
||||
*s = toupper((unsigned char) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
return 0;
|
||||
|
||||
ToUpperString(argv[1]);
|
||||
printf("\n[+] Hashed %s ==> 0x%x\n\n", argv[1], Hash( argv[1] ));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*( .text$A )
|
||||
*( .text$B )
|
||||
*( .text$C )
|
||||
*( .text$D )
|
||||
*( .text$E )
|
||||
*( .rdata* )
|
||||
*( .text$F )
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
import pefile
|
||||
import argparse
|
||||
|
||||
if __name__ in '__main__':
|
||||
try:
|
||||
parser = argparse.ArgumentParser( description = 'Extracts shellcode from a PE.' );
|
||||
parser.add_argument( '-f', required = True, help = 'Path to the source executable', type = str );
|
||||
parser.add_argument( '-o', required = True, help = 'Path to store the output raw binary', type = str );
|
||||
option = parser.parse_args();
|
||||
|
||||
PeExe = pefile.PE( option.f );
|
||||
PeSec = PeExe.sections[0].get_data();
|
||||
|
||||
if PeSec.find( b'ENDOFCODE' ) != None:
|
||||
ScRaw = PeSec[ : PeSec.find( b'ENDOFCODE' ) ];
|
||||
f = open( option.o, 'wb+' );
|
||||
f.write( ScRaw );
|
||||
f.close();
|
||||
else:
|
||||
print('[!] error: no ending tag');
|
||||
except Exception as e:
|
||||
print( '[!] error: {}'.format( e ) );
|
||||
|
||||
Reference in New Issue
Block a user