Skip to content

Refactoring and adding source code #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions endec_arg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/bin/env python
import re
import base64
import hashlib
import binascii
import argparse
from sys import argv
from itertools import cycle
from string import lowercase, uppercase

author = '''
=====================================================
===================================================
=-=-=-=-=-=-=-=- B3yeZ Tools -=-=-=-=-=-=-=-=
=-=-=-=-=-=- Author : Bayu Fedra A -=-=-=-=-=-=
===================================================
=====================================================
____ ______ _______ _
| _ \\ |___ / |__ __| | |
| |_) | ___ _ _ ___ / / | | ___ ___ | |___
| _ < / _ \\ | | |/ _ \\ / / | |/ _ \\ / _ \\| / __|
| |_) | __/ |_| | __// /__ | | (_) | (_) | \\__ \\
|____/ \\___|\\__, |\\___/_____| |_|\\___/ \\___/|_|___/
__/ |
|___/ [email protected]
'''
b3yez = '{+} Thank You dude, please keep support, FB : https://www.facebook.com/bayufedra / Instagram : http://instagram.com/bayufedraa {+}'


def fn_result(s_res):
print '[+] Result => {}'.format(s_res)
#print b3yez

def fn_error(s_msg):
print '[-] Error, not {} strings'.format(s_msg)

def fn_main():
print author
halah = argparse.ArgumentParser(description=' [+] Tools to Encoding, Decoding and Hashing [+]')
halah.add_argument('str', help='Strings')
halah.add_argument('-e', action='store_true', help='encode strings')
halah.add_argument('-d', action='store_true', help='decode strings')
halah.add_argument('-brute', action='store_true', help='Bruteforce char')
halah.add_argument('-key', type=int, action='store', help='Key for char caessar cipher')
halah.add_argument('-k', type=str, action='store', help='Key for char xor')
halah.add_argument('-b64', action='store_true', help='Base64 encryptions')
halah.add_argument('-b32', action='store_true', help='Base32 encryptions')
halah.add_argument('-b16', action='store_true', help='Base16 encryptions')
halah.add_argument('-hex', action='store_true', help='Hexadecimal')
halah.add_argument('-dec', action='store_true', help='Decimal')
halah.add_argument('-bin', action='store_true', help='Binary')
halah.add_argument('-rev', action='store_true', help='Reverse Strings')
halah.add_argument('-rot13', action='store_true', help='ROT 13 Cipher')
halah.add_argument('-caes', action='store_true', help='Caessar Cipher')
halah.add_argument('-xor', action='store_true', help='XOR Cipher')
halah.add_argument('-md5', action='store_true', help='MD5 Hashing')
halah.add_argument('-sha1', action='store_true', help='SHA1 Hashing')
halah.add_argument('-sha256', action='store_true', help='SHA256 Hashing')
halah.add_argument('-sha512', action='store_true', help='SHA512 Hashing')
wibu = halah.parse_args()

if wibu.b64 and wibu.e:
fn_result(base64.b64encode(wibu.str))

if wibu.b64 and wibu.d:
try:
fn_result(base64.b64decode(wibu.str))
except:
fn_error('base64')

if wibu.b32 and wibu.e:
fn_result(base64.b32encode(wibu.str))

if wibu.b32 and wibu.d:
try:
fn_result(base64.b32decode(wibu.str))
except:
fn_error('base32')

if wibu.b16 and wibu.e:
fn_result(base64.b16encode(wibu.str))

if wibu.b16 and wibu.d:
try:
fn_result(base64.b16decode(wibu.str))
except:
fn_error('base16')

if wibu.hex and wibu.e:
fn_result(binascii.hexlify(wibu.str))

if wibu.hex and wibu.d:
try:
fn_result(binascii.unhexlify(wibu.str))
except:
fn_error('hexadecimal')

if wibu.dec and wibu.e:
fn_result(''.join([str(ord(c)) for c in wibu.str]))

if wibu.dec and wibu.d:
try:
fn_result(re.sub('1?..', lambda m: chr(int(m.group())), wibu.str))
except:
fn_error('decimal')

if wibu.bin and wibu.e:
fn_result(bin(int(binascii.hexlify(wibu.str), 16)))

if wibu.bin and wibu.d:
try:
fn_result(binascii.unhexlify('%x' % int(wibu.str, 2)))
except:
fn_error('binary')

if wibu.rev:
fn_result(wibu.str[::-1])

if wibu.rot13:
if wibu.rot13 or wibu.e or wibu.d:
fn_result(wibu.str.encode('rot_13'))

if wibu.caes and wibu.key:
en = wibu.str
n = wibu.key
hasil = ''
for x in range(len(en)):
if en[x].isalpha():
if en[x].islower():
hasil = hasil + lowercase[(lowercase.find(en[x]) + n) % 26]
else:
hasil = hasil + uppercase[(uppercase.find(en[x]) + n) % 26]
else:
hasil = hasil + en[x]
fn_result(hasil)

if wibu.caes and wibu.brute:
for i in range(26):
hasil = ''
for x in range(len(wibu.str)):
if wibu.str[x].isalpha():
if wibu.str[x].islower():
hasil = hasil + lowercase[(lowercase.find(wibu.str[x]) + i) % 26]
else:
hasil = hasil + uppercase[(uppercase.find(wibu.str[x]) + i) % 26]
else:
hasil = hasil + wibu.str[x]
print '{} => [+] Result => {}'.format(str(i), hasil)

if wibu.xor and wibu.brute:
for i in range(256):
print '{} => [+] Result => {}'.format(str(i), ''.join([chr(ord(l) ^ i) for l in wibu.str]))

if wibu.xor and wibu.k:
string = wibu.str
n = wibu.k
hasil = ''
for c, k in zip(string, cycle(n)):
hasil += chr(ord(c) ^ ord(k))
fn_result(hasil)

if wibu.md5:
if wibu.md5 or wibu.e:
fn_result(hashlib.md5(wibu.str.encode('utf')).hexdigest())

if wibu.sha1:
if wibu.sha1 or wibu.e:
fn_result(hashlib.sha1(wibu.str.encode('utf')).hexdigest())

if wibu.sha256:
if wibu.sha256 or wibu.e:
fn_result(hashlib.sha256(wibu.str.encode('utf')).hexdigest())

if wibu.sha512:
if wibu.sha512 or wibu.e:
fn_result(hashlib.sha512(wibu.str.encode('utf')).hexdigest())


if __name__ == '__main__':
fn_main()
Binary file modified endec_arg.pyc
Binary file not shown.
197 changes: 197 additions & 0 deletions endec_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/bin/env python
import os
import re
import sys
import base64
import hashlib
import binascii
import platform
import itertools
from itertools import cycle
from string import lowercase, uppercase

str_menu = '''
[1] Base64
[2] Base32
[3] Base16
[4] Binary
[5] Hexadecimal
[6] Decimal
[7] ROT13
[8] Caesar
[9] Reversed Text
[10] MD5 Hash
[11] SHA1 Hash
[12] SHA256 Hash
[13] SHA512 Hash
[14] Xor Bruteforce
[15] Xor With Key
[16] Cancel

[i] Pilihan : '''

str_endeop = '''
[1] Encode
[2] Decode

[i] Opsi : '''

str_cont = '''
[1] Lanjut
[2] Tidak

[i] Pilihan: '''

l_edr = ['[+] Hasil : ',\
'[i] Text to Encode : ',\
'[i] Text to Decode : ']

def fn_x64(i_opt):
a = [{1:base64.b64encode, 2:base64.b64decode},\
{1:base64.b32encode, 2:base64.b32decode},\
{1:base64.b16encode, 2:base64.b16decode}]
b = int(raw_input(str_endeop))
print ''
if (b > 2): sys.exit()
s = raw_input(l_edr[b])
print l_edr[0] + a[i_opt][b](s)

def fn_hex():
a = int(raw_input(str_endeop))
print ''
if (a > 2): sys.exit()
b = raw_input(l_edr[a])
return a,b

def fn_csr(n, s_csr):
s_out = ''
for x in xrange(len(s_csr)):
if s_csr[x].isalpha():
if s_csr[x].islower():
s_out += lowercase[(lowercase.find(s_csr[x]) + n) % 26]
else:
s_out += uppercase[(uppercase.find(s_csr[x]) + n) % 26]
else:
s_out += s_csr[x]
return s_out

def fn_hash(i_opt):
a = [{0:hashlib.md5, 1:'[i] MD5 Hash Encode: '},\
{0:hashlib.sha1, 1:'[i] SHA1 Hash Encode: '},\
{0:hashlib.sha256, 1:'[i] SHA256 Hash Encode: '},\
{0:hashlib.sha512, 1:'[i] SHA512 Hash Encode: '}]
print l_edr[0] + a[i_opt][0](raw_input(a[i_opt][1]).encode('utf')).hexdigest()

def fn_done():
print '''
[+] Thank You dude, please keep support
[+] FB : https://www.facebook.com/bayufedra
[+] Instagram : http://instagram.com/bayufedraa'''
sys.exit()

def fn_main():
if platform.system == 'Windows':
os.system('cls')
else:
os.system('clear')

print '''
===================================================
=================================================
=-=-=-=-=-=-=-= B3yeZ Tools =-=-=-=-=-=-=-=
=-=-=-=-=-= Author : Bayu Fedra A =-=-=-=-=-=
=================================================
===================================================
____ ______ _______ _
| _ \\ |___ / |__ __| | |
| |_) | ___ _ _ ___ / / | | ___ ___ | |___
| _ < / _ \\ | | |/ _ \\ / / | |/ _ \\ / _ \\| / __|
| |_) | __/ |_| | __// /__ | | (_) | (_) | \\__ \\
|____/ \\___|\\__, |\\___/_____| |_|\\___/ \\___/|_|___/
__/ |
|___/ [email protected]

root@B3yeZ:~# cat list.txt'''

while True:
try:
listt = int(raw_input(str_menu))
if listt == 1:
fn_x64(0)

elif listt == 2:
fn_x64(1)

elif listt == 3:
fn_x64(2)

elif listt == 4:
o,s = fn_hex()
print '{}{}'.format(l_edr[0], bin(int(binascii.hexlify(s), 16)) if (o == 1) else binascii.unhexlify('%x' % int(s, 2)) if (o == 2) else '')

elif listt == 5:
o,s = fn_hex()
print '{}{}'.format(l_edr[0], binascii.hexlify(s) if (o == 1) else binascii.unhexlify(s) if (o == 2) else '')

elif listt == 6:
o = int(raw_input(str_endeop))
print ''
if (o > 2): break
s = raw_input(l_edr[o])
print '{}{}'.format(l_edr[0], ''.join([str(ord(c)) for c in s]) if (o == 1) else re.sub('1?..', lambda m: chr(int(m.group())), s) if (o == 2) else '')

elif listt == 7:
print '{}{}'.format(l_edr[0], raw_input('[i] Text to En/Decode : ').encode('rot_13'))

elif listt == 8:
o = int(raw_input(str_endeop))
print ''
if o == 1:
en = raw_input(l_edr[o])
n = input('[i] Key : ')
print '{}{}'.format(l_edr[0], fn_csr(n, en))
if o == 2:
en = raw_input('[i] Caesar to Bruteforce : ')
for i in xrange(26):
print ' {} => Hasil ===> {}'.format(str(i), fn_csr(i, en))

elif listt == 9:
print '{}{}'.format(l_edr[0], raw_input('[i] Text to Reverse : ')[::-1])

elif listt == 10:
fn_hash(0)

elif listt == 11:
fn_hash(1)

elif listt == 12:
fn_hash(2)

elif listt == 13:
fn_hash(3)

elif listt == 14:
a = raw_input('[i] XOR to Bruteforce : ')
for i in xrange(256):
print '{} => Hasil ===> {}'.format(str(i), ''.join([chr(ord(l) ^ i) for l in a]))

elif listt == 15:
a = raw_input('[i] Strings to XOR : ')
b = raw_input('[i] Key : ')
hasil = ''
for c, k in zip(a, cycle(b)):
hasil += chr(ord(c) ^ ord(k))
print '{}{}'.format(l_edr[0], hasil)

elif listt == 16:
fn_done()

if int(raw_input(str_cont)) == 2:
fn_done()

except KeyboardInterrupt:
sys.exit()


if __name__ == '__main__':
fn_main()
Binary file modified endec_list.pyc
Binary file not shown.