|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +#------------------Bombermans Team---------------------------------# |
| 4 | +#Author : B3mB4m |
| 5 | + |
| 6 | +#Project : https://github.com/b3mb4m/Shellsploit |
| 7 | +#LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE |
| 8 | +#------------------------------------------------------------------# |
| 9 | + |
| 10 | + |
| 11 | +""" |
| 12 | +Except AES every function is working on 2x and 3x.We'll fix it soon and add couple of things to .. |
| 13 | +""" |
| 14 | + |
| 15 | +def base64( TEXT, choice): |
| 16 | + from base64 import b64encode,b64decode |
| 17 | + return b64encode(TEXT.encode('utf-8')).decode('utf-8') if choice == "encode" else b64decode(TEXT).decode("utf-8") |
| 18 | + |
| 19 | +def base32( TEXT, choice): |
| 20 | + from base64 import b32encode,b32decode |
| 21 | + return b32encode(TEXT.encode('utf-8')).decode('utf-8') if choice == "encode" else b32decode(TEXT).decode("utf-8") |
| 22 | + |
| 23 | +def base16( TEXT, choice): |
| 24 | + from base64 import b16encode,b16decode |
| 25 | + return b16encode(TEXT.encode('utf-8')).decode('utf-8') if choice == "encode" else b16decode(TEXT).decode("utf-8") |
| 26 | + |
| 27 | +def hex_( TEXT, choice): |
| 28 | + from codecs import encode,decode |
| 29 | + return encode(TEXT.encode('utf-8'), "hex").decode('utf-8') if choice == "encode" else decode(TEXT, "").decode("utf-8") |
| 30 | + |
| 31 | +def md5( TEXT): |
| 32 | + from hashlib import md5 |
| 33 | + return md5(TEXT.encode("utf-8")).hexdigest() |
| 34 | + |
| 35 | +def sha1( TEXT): |
| 36 | + from hashlib import sha1 |
| 37 | + return sha1(TEXT.encode("utf-8")).hexdigest() |
| 38 | + |
| 39 | +def sha224( TEXT): |
| 40 | + from hashlib import sha224 |
| 41 | + return sha224(TEXT.encode("utf-8")).hexdigest() |
| 42 | + |
| 43 | +def sha256( TEXT): |
| 44 | + from hashlib import sha256 |
| 45 | + return sha256(TEXT.encode("utf-8")).hexdigest() |
| 46 | + |
| 47 | +def sha384( TEXT): |
| 48 | + from hashlib import sha384 |
| 49 | + return sha384(TEXT.encode("utf-8")).hexdigest() |
| 50 | + |
| 51 | +def sha512( TEXT): |
| 52 | + from hashlib import sha512 |
| 53 | + return sha512(TEXT.encode("utf-8")).hexdigest() |
| 54 | + |
| 55 | + |
| 56 | +def AES( TEXT, KEY, choice): |
| 57 | + from sys import version_info |
| 58 | + from base64 import b64encode,b64decode |
| 59 | + |
| 60 | + try: |
| 61 | + from Crypto.Cipher import AES |
| 62 | + from Crypto import Random |
| 63 | + except ImportError: |
| 64 | + print ("\npycrypto must be installed.\n") |
| 65 | + return False |
| 66 | + |
| 67 | + #AES key must be either 16, 24, or 32 bytes long |
| 68 | + BS = len(KEY) if len(KEY) % 16 == 0 or len(KEY) % 24 == 0 or len(KEY) % 32 == 0 else False |
| 69 | + pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) |
| 70 | + unpad = lambda s : s[:-ord(s[len(s)-1:])] |
| 71 | + |
| 72 | + if choice == "encode": |
| 73 | + raw = pad(TEXT) |
| 74 | + iv = Random.new().read(AES.block_size) |
| 75 | + cipher = AES.new(KEY, AES.MODE_CBC, iv) |
| 76 | + return b64encode(iv + cipher.encrypt( raw)) if version_info[0] == 2 else b64encode(iv + cipher.encrypt( raw), "encode").decode("utf-8") |
| 77 | + else: |
| 78 | + enc = b64decode(TEXT) |
| 79 | + iv = enc[:16] |
| 80 | + cipher = AES.new(KEY, AES.MODE_CBC, iv) |
| 81 | + return unpad(cipher.decrypt( enc[16:])) if version_info[0] == 2 else unpad(cipher.decrypt( enc[16:])).decode("utf-8") |
| 82 | + |
0 commit comments