View difference between Paste ID: qFAGygEj and gPrhu5Z6
SHOW: | | - or go back to the newest paste.
1
#!/usr/bin/python
2
# -*- coding:utf-8 -*-
3
4
import sys
5
import argparse
6
import binascii
7
import time
8
9
def Banner():
10
	print" _______                              _______ __           __ __                __        "
11
	print"|     __|.----.-----.-----.-----.    |     __|  |--.-----.|  |  |.----.-----.--|  |.-----."
12
	print"|    |  ||   _|  -__|  -__|     |    |__     |     |  -__||  |  ||  __|  _  |  _  ||  -__|"
13
	print"|_______||__| |_____|_____|__|__|    |_______|__|__|_____||__|__||____|_____|_____||_____|"
14
	print"\t\t\t\tCoded By Zer0C0de\n"
15
16
def encode(code):
17
	for encoded in code:
18
		print "\b\\x"+encoded.encode("hex"),
19
	print "\n"
20
21
parser = argparse.ArgumentParser()
22
parser.add_argument("-e","--encode",help="Encode a string")
23
parser.add_argument("-d","--decode",help="Decode a string")
24
parser.add_argument("-s","--stringfile",help="Encode from a file")
25
parser.add_argument("-f","--filedecode",help="Decode from a file")
26
27
args = parser.parse_args()
28
29
if args.filedecode:
30
	fl = args.filedecode
31
	Banner()
32
	try:
33
		f = open(fl,"r")
34
		for decod in f:
35
			print "shellcode => ",decod
36
			cleaninput = decod.replace("\\x","").rstrip('\n')
37
			print "hex       => ",cleaninput
38
			print "plaintext => ",
39
			print "\b"+cleaninput.decode("hex")+"\n"
40
	except IOError:
41
			print fl+" isnt found"
42
43
if args.stringfile:
44
	fl = args.stringfile
45
	Banner()
46
	f = open(fl,'rw')
47
	strings = {}
48
	for line in f:
49
		strings[line] = line.rstrip('\n')
50
	try:
51
		for enc in strings.keys():
52
			print "plain text => "+strings[enc]
53
			print "hex        => "+enc.encode("hex")
54
			print "shellcode  => ",
55
			encode(strings[enc])
56
	except IOError:
57
			print fl+"isnt found"
58
	f.close()
59
60
if args.encode:
61
	Banner()
62
	enc = args.encode 
63
	print "plain text => "+enc+"\n",
64
	print "hex        => "+enc.encode("hex")
65
	print "shellcode => ",
66
	for encoded in enc:
67
		print("\b\\x"+encoded.encode("hex")),
68
	print "\n"
69
70
if args.decode:
71
	Banner()
72
	dec = args.decode
73
	cleaninput = dec.replace("\\","")
74
	cleaninput = dec.replace("x","") 
75
	print "shellcode => ",dec
76
	print "hex       => ",cleaninput
77
	print "plaintext => ",
78
	print "\b"+cleaninput.decode("hex")