-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhextostr
executable file
·32 lines (27 loc) · 894 Bytes
/
hextostr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# _ _ ___ _ _
# __ _| | _____ _____ ___ __| | ___ _ __ / _ \| || |
# / _` | |/ _ \ \/ / __/ _ \ / _` |/ _ \ '__| | | | || |_
# | (_| | | __/> < (_| (_) | (_| | __/ | | |_| |__ _|
# \__,_|_|\___/_/\_\___\___/ \__,_|\___|_| \___/ |_|
#
# Copyright (c) 2021 alexcoder04 <https://github.com/alexcoder04>
#
# decode hex notation
import sys
hexstr = input("hex> ")
all_bytes = []
byte = ""
for i, n in enumerate(hexstr):
if i % 2 == 0:
byte = n
continue
byte += n
#print("0x" + byte)
#print(eval("0x" + byte))
#print(eval("chr(0x" + byte + ")"))
all_bytes.append(eval("chr(0x" + byte + ")"))
print("string:")
print("------------------------------------------------")
sys.stdout.write("".join(all_bytes))
print("------------------------------------------------")