使用MitmProxy绕过Content Security Policy (CSP)

这几天测试用Selenium 和 Chrome插件都无法在 谷歌插件商店https://chrome.google.com/webstore/category/extensions?hl=en 实现JS注入 检查发现响应头里面有一个 ‘content-security-policy’,错误提示: "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src ‘report-sample’ ‘nonce-wNKF1pjNhZent+g6jyFL9g’ ‘unsafe-inline’ ‘unsafe-eval’". Note that ‘unsafe-inline’ is ignored if either a hash or nonce value is present in the source list." CSP全称Content Security Policy ,可以直接翻译为内容安全策略,说白了,就是为了页面内容安全而制定的一系列防护策略. 通过CSP所约束的的规责指定可信的内容来源(这里的内容可以指脚本、图片、iframe、fton、style等等可能的远程的资源)。通过CSP协定,让WEB处于一个安全的运行环境中. 我这里使用MitmProxy绕过CSP执行JS注入 脚本如下 from bs4 import BeautifulSoup… Read More »

使用mitmproxy实现JS注入的脚本

injected-javascript的JS注入脚本 ((time) => {   const handleDocumentLoaded = () => {     document.getElementById("injected-time").innerHTML = time;   };   if (document.readyState === "loading") {     document.addEventListener("DOMContentLoaded", handleDocumentLoaded);   } else {     handleDocumentLoaded();   } })(Date.now()); mitmproxy脚本 from bs4 import BeautifulSoup from mitmproxy import ctx # Load in the javascript to inject. with… Read More »

使用Chrome插件在页面加载完成之前执行JS注入

使用以下代码可以跳过chrome 插件沙盒执行JS注入 extension/manifest.json {   "manifest_version": 2,   "name": "Content Script Sandbox Breakout Extension",   "version": "1.0.0",   "applications": {     "gecko": {       "id": "[email protected]"     }   },   "content_scripts": [     {       "matches": ["<all_urls>"],       "js": ["sandbox-breakout.js"],       "run_at": "document_start"… Read More »

XenServer安装后,解决系统盘4G大小限制无法上传大于4g的ISO镜像(挂载新建盘的方法)

此法不稳定 我们都知道xenserver安装后,不管你的盘有多大,只有4G的空间。 故操作是:新建LV卷,可自定义大小 若ISO仓库已经创建好了,只需执行步骤1、2、3、4、5、7、8、9,把新的逻辑卷硬盘挂载到/opt/iso文件下(原来的镜像会消失) 1、vgdisplay #先查看剩余空间 [root@XenServer /]# vgdisplay — Volume group — VG Name VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 8 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 11.99 GB… Read More »

iMobiTrax 3.8安装相关资料!

假设你的IM服务器IP为:8.8.4.4,操作系统为centos,环境为lnmp 1.在8.8.4.4服务器默认目录中(如lnmp.org环境,默认目录为/home/wwwroot/default/),新建一个名为~imobi文件夹,在~imobi文件夹下新建一个名为license的文件夹,复制本文件(api2.php)到license目录下; 2.在浏览器中访问本文件对应的URL网址,确认是否可以访问,如 http://8.8.4.4/~imobi/license/api2.php (注:把8.8.4.4替换为你服务器的真实IP); 3.检查IP forward是否开启: 运行 cat /proc/sys/net/ipv4/ip_forward 如果返回结果为1,表示IP forward已开启;返回结果为0,表示IP forward没开启; 4.如果 IP forward 没开启,修改/etc/sysctl.conf 将其中 “net.ipv4.ip_forward = 0” 修改为 “net.ipv4.ip_forward = 1” 如果没有上述这行,在/etc/sysctl.conf文件中增加这行 运行 sysctl -p 使修改生效 5.增加包转发策略 运行 iptables -t nat -A OUTPUT -d 50.28.102.240 -j DNAT –to 8.8.4.4 (注:把8.8.4.4替换为你服务器的真实IP) 6.检查转发策略是否启用 iptables -L -t nat 如果在Chain OUTPUT (policy ACCEPT)中有如下条目 DNAT all… Read More »

Xencenter 创建iso本地库

在根下创建iso挂载目录 mkdir /iso 创建本地iso库 xe sr-create name-label=ISO type=iso device-config:location=/iso  device-config:legacy_mode=true content-type=iso

【技巧】Windows Server 2012/2016/2019桌面显示我的电脑图标

从Windows Server 2012开始,微软取消了服务器桌面个性化设置功能,Windows Server 2012/2016用户桌面上默认只有一个回收站的图标,这让习惯于使用我的电脑图标功能的用户很不适应,本文说明如何让Windows Server 2012/2016的用户桌面显示我的电脑图标。 很简单的事情就不上图了,操作如下: 打开运行对话框 按下Windows系统热键Win+R,打开运行对话框。 输入如下命令,按回车或点击确定按钮,就会打开桌面图标设置功能。 rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0 桌面图标设置功能 这样就出现了原来的桌面图标设置功能,需要显示什么自己勾选即可。

Mitmproxy + Python安装和使用的一些问题

安装: pip3 install mitmproxy 国内: pip install mitmproxy -i http://pypi.douban.com/simple –trusted-host pypi.douban.com 如果’Microsoft Visual C++ Build Tools’错误,可以在https://visualstudio.microsoft.com/zh-hans/downloads/ 直接下载安装即可 如果’Dll load error…..’ 错误,安装VC https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads 检查是否安装成功: mitmdump –version 版本升级: pip install –upgrade mitmproxy 安装证书 访问 http://mitm.it/ 自动安装 手动: 命令 certutil -addstore root mitmproxy-ca-cert.cer 自定义脚本 : 脚本内容是实时修改生效 mitmdump -s xxx.py 指定代理 –mode upstream:http://192.168.0.1:8800 忽略HOST / 忽略多个host –ignore-hosts ^google\.com:443$… Read More »

使用浏览器特征检测浏览器

// Opera 8.0+ var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(’ OPR/’) >= 0; // Firefox 1.0+ var isFirefox = typeof InstallTrigger !== ‘undefined’; // Safari 3.0+ "[object HTMLElementConstructor]" var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window[’safari’] || (typeof safari !== ‘undefined’ && safari.pushNotification)); // Internet Explorer… Read More »

全球网站在线测速

Pingdom Website Speed Test https://tools.pingdom.com/ website monitoring service https://www.host-tracker.com/ 卡卡网 http://www.webkaka.com/UrlCheck.aspx WebSitePulse Test Tools https://www.websitepulse.com/tools/ Free Web Speed Test http://www.freespeedtest.com/ Web Page Analyzer http://websiteoptimization.com/services/analyze/ Check Website https://asm.ca.com/en/checkit.php