python虚拟环境打包

主要是为了减少py的体积

image-20211215210116723.png

带图形化的可以不使用-F
使用-D启动速度会更快

python requirements.txt生成

  1. pipreqs ./ --encoding=utf8

image.png

python 内嵌浏览器网页

  1. import wx
  2. from wx.html2 import WebView
  3. class MyHtmlFrame(wx.Frame):
  4. def __init__(self, parent, title):
  5. wx.Frame.__init__(self, parent, -1, title, size=(1024, 768))
  6. web_view =WebView.New(self)
  7. web_view.LoadURL("https://cn.bing.com/translator")
  8. app = wx.App()
  9. frm = MyHtmlFrame(None, "Simple HTML Browser")
  10. frm.Show()
  11. app.MainLoop()

更新Invoke-Mimikatz

  1. import fileinput
  2. import base64
  3. with open("./Win32/mimikatz.exe", "rb") as f:
  4. win32 = base64.b64encode(f.read()).decode()
  5. with open("./x64/mimikatz.exe", "rb") as f:
  6. x64 = base64.b64encode(f.read()).decode()
  7. for line in fileinput.FileInput("./Invoke-Mimikatz.ps1", inplace=1):
  8. line = line.rstrip('\r\n')
  9. if "$PEBytes64 = " in line:
  10. print("$PEBytes64 = '" + x64 + "'")
  11. elif "$PEBytes32 = " in line:
  12. print("$PEBytes32 = '" + win32 + "'")
  13. else:
  14. print(line)

Python 正则表达式匹配两个指定字符串中间的内容

A(.*?)B 表示截取 A/B 中间的字符串

  1. import re
  2. txt='@font-face{font-family:"customfont"; src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAACHMAHUrlQa1/U/GjaKLvBmPZEW9aysrJJd8fcdtKlebEw+i+9+ss+zY9V28te/XU+6HyW/QK0Vmv==)'
  3. bs64_str = re.findall("charset=utf-8;base64,(.*?)\)", txt)[0]
  4. print(bs64_str)
  5. #d09GRgABAAAAACHMAHUrlQa1/U/GjaKLvBmPZEW9aysrJJd8fcdtKlebEw+i+9+ss+zY9V28te/XU+6HyW/QK0Vmv===

ssl报错问题

  1. requests.packages.urllib3.disable_warnings()
  2. r=requests.get(host,timeout=3,verify=False,proxies=proxies)