神兵利器 - Shellcode 加解密脚本

admin 2022年5月3日22:33:27安全工具评论7 views2312字阅读7分42秒阅读模式


神兵利器 - Shellcode 加解密脚本


安装

git clone https://github.com/blacknbunny/Shellcode-Encrypter-Decrypter.git && cd Shellcode-Encrypter-Decrypter/python encdecshellcode.py --help

示例

Encryption:
python encdecshellcode.py --shellcode x41x41x42x42 --key SECRETKEY --option encrypt
Decryption:
python encdecshellcode.py --shellcode x41x41x42x42 --key SECRETKEY --option decrypt

各种shellcode

http://shell-storm.org/shellcode/

import argparsefrom sys import argv, stdout, exit
parser = argparse.ArgumentParser(description="Encrypting & Decrypting Shellcode")parser.add_argument('-s', '--shellcode', help='Shellcode To Encrypt & Decrypt')parser.add_argument('-k', '--key', help='Key Of The Shellcode To Encrypt & Decrpyt', default='key')parser.add_argument('-o', '--option', help='Argument For Encrypting or Decrypting The Shellcode')
args = parser.parse_args()
def EncryptShellcode(shellcode, key):
shellcode_encrypted_hex = [] shellcode_decrypted_hex = [] shellcode_replaced_hex = ''

count = 0 for d in range(0, len(shellcode) / 4): count += 4 shellcode_decrypted_hex.append(shellcode[count-4:count].replace(r'x', ''))
for x in range(0, len(shellcode_decrypted_hex)): for d in range(0, len(key)): shellcode_encrypted_hex.append(hex(ord(shellcode_decrypted_hex[x].decode('hex')) ^ ord(key[d])))
for y in range(0, len(shellcode_encrypted_hex)): shellcode_replaced_hex += shellcode_encrypted_hex[y].replace('0x', r'x')
return shellcode_replaced_hex
def DecryptShellcode(shellcode, key): shellcode_decrypted = [] shellcode_xor_headers = []
shellcode_replaced_hex = '' string = ''
for x in shellcode: string += shellcode.replace(r'x', '') break
count = 0 for y in string: shellcode_xor_headers.append(string[count:count+2]) count += 6
while '' in shellcode_xor_headers: shellcode_xor_headers.remove('')

for z in range(len(shellcode_xor_headers)): shellcode_decrypted.append(hex(ord(shellcode_xor_headers[z].decode('hex')) ^ ord(key[0])))
for h in range(0, len(shellcode_decrypted)): shellcode_replaced_hex += shellcode_decrypted[h].replace('0x', r'x')
return shellcode_replaced_hexdef PrintHelp(): parser.print_help() exit(1)
def main(): try: shellcode = args.shellcode key = args.key if args.option == "encrypt": print( "Encrypted Shellcode = " + EncryptShellcode(shellcode, key) ) elif args.option == "decrypt": print( "nDecrypted Shellcode = " + DecryptShellcode(shellcode, key) ) else: PrintHelp() except Exception as e: PrintHelp() print(e)
if __name__ == '__main__': exit(main())

项目地址:

https://github.com/blacknbunny/encdecshellcode

原文始发于微信公众号(Khan安全攻防实验室):神兵利器 - Shellcode 加解密脚本

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月3日22:33:27
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  神兵利器 - Shellcode 加解密脚本 http://cn-sec.com/archives/971126.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: