Python requests socks代理

更新requests 为支持socks的版本:

pip install -U requests[socks]

测试代码:

import requests

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
}

proxies = {
    #'socks5': '127.0.0.1:8889'
    'http':'socks5://127.0.0.1:8889',
    'https':'socks5://127.0.0.1:8889'
}
url = 'http://nkm3s8.xyz/'
try:
    print('Proxy:')
    res = requests.get(url, headers=headers, proxies=proxies, timeout=10)
    print(res)
except Exception as e:
    print(e)

try:
    print('No Proxy:')
    res = requests.get(url, headers=headers, timeout=10)
    print(res)
except Exception as e:
    print(e)

EC2通过命令上传文件到S3

爬虫文件在服务器上爬取数据的时候下载了很多的数据,为了保存这些数据,给这些数据做个备份于是就想把文件传到s3存储上。其实要上传文件也比较简单,通过awscli命令行工具即可上传。首选需要去aws的后台创建访问安全凭证。点击用户名,选择访问密钥,创建新的访问密钥,下载之后是一个csv文件包含AWSAccessKeyId和AWSSecretKey

在服务器上安装awscli,执行

sudo apt install awscli

安装aws命令行工具。

安装完成之后执行

aws configure

进行配置,输入key和secret即可:

最后两项可以留空。

Continue Reading

mht文件图片解析工具(兼容Chrome/Blink)

之前写过一个mht文件的解析工具,不过当时解析的文件都是ie生成的。没有测试过chrome解析的文件。今天在github上看到一个反馈:https://github.com/obaby/mht-image-extractor/issues/1 qq浏览器保存的文件无法提取,chrome保存的文件会直接崩溃。下载附件的文件解析后发现,这两个文件的文件格式与ie的文件格式并不一致,文件头改成了如下的内容:

From: 
Snapshot-Content-Location: https://mp.weixin.qq.com/s?__biz=MzU1NzQ3MTg5OQ==&mid=2247483652&idx=1&sn=a16979f8b088cb60fb63f210536d5288&chksm=fc3400f0cb4389e698a5a3ce1bf6a6ab3ff6f547bb4db409893850b0c502053d1fea40f70fda&sessionid=0&scene=126&subscene=0&clicktime=1599463540&enterid=1599463540&ascene=3&devicetype=android-28&version=27001237&nettype=ctnet&abtest_cookie=AAACAA%3D%3D&lang=zh_CN&exportkey=AUPVIV8Yt1hvPJ2dYKFWhvM%3D&pass_ticket=eTzcuEu%2BGavsf30E3HDErOhtb18ThPDhge008pIBzY7AFq0IuG1LUgojTpufwqUZ&wx_header=1
Subject: =?utf-8?Q?=E6=B1=89=E6=9C=8D=E4=B8=A8=E5=BD=BC=E5=B2=B8=E8=8A=B1=E5=BC=80?=
Date: Sun, 20 Sep 2020 00:50:44 -0000
MIME-Version: 1.0
Content-Type: multipart/related;
    type="text/html";
    boundary="----MultipartBoundary--Bx5ubV1DnfL8hvvsySfZL6MQeLa58tWkfwrQGpothO----"

而ie保存的文件头则是如下格式的:

Content-Type: multipart/related; start=op.mhtml.1267442701515.fe60c16c115c15f9@169.254.195.209; boundary=----------pMKI1vNl6U7UKeGzbfNTyN Content-Location: http://a.10xjw.com/feizhuliu/89905.html
Subject: =?utf-8?Q?=E8=B6=85=E7=BE=8E=E4=B8=9D=E6=8E=A7=E5=A7=90=E5=A6=B9=E8=8A=B1=E7=A7=92=E6=9D=80=E4=BD=A0=E6=B2=A1=E9=97=AE=E9=A2=98[26P]-=2037kxw.com=20-=20=E4=B8=AD=E5=9B=BD=E6=9C=80=E5=A4=A7=E7=9A=84=E8=89=B2=E6=83=85=E5=88=86=E4=BA=AB=E7=BD=91=E7=AB=99?= MIME-Version: 1.0
Continue Reading

JEB Decompiler PRO 3.19.1 (May 7, 2020) by PNF Software

Core:
– DEX Decompiler: Emulator: improvements
– DEX Decompiler: fixes on corner-case scenarios
– Java: Decompiled source: matched parentheses/brackets/braces open-close
– Dex/Dalvik: more information for query xrefs action
– Dex/Dalvik: some fixes, more tolerant Dalvik parsing in corner-cases
– Operation: added COPY_ADDRESS (see API; mapped to menu “Navigation, Copy Address” in UI client)
– Native: Siglibs updates
– Other fixes

Client:
– Cross-references panel: the dialog is now modeless (keep navigating, jump to xrefs without closing the widget)
– Navigation: fixes and tweaks in history navigation (more to be smoothed out, navigating the history remains counter-intuitive in some cases)
– Styles/Themes: added light/sepia fall-back for system-wide dark modes if needed
– Themes: fixed standard theme on dark-mode macOS with recent JDK
– UI client is now compatible with recent JDK, incl. JDK 14. JEB’s native launcher will not work on linux/macOS though.
Note: we recommend to keep on using JDK 8u191+.
– Other fixes

Continue Reading

浅谈iOS游戏的汉化

基于windows平台的游戏汉化,软件汉化已经比较成熟,网上的教程攻略,帖子也非常多。但是基于iOS平台的软件汉化网上却鲜有资源。我这里想说的是两个比较另类的软件汉化方法。由于项目有些久远,记忆有些偏差,可能有部分内容记录的会有问题。

1. 跨平台游戏的汉化

多数跨平台的游戏,可执行文件资源可能都是基于同一套代码编译。那么对于跨平台游戏的汉化可以采用借尸还魂的方法。当然该方法可能并不通用,智能能够借尸还魂还要看具体的游戏。例如恶霸鲁尼,这款游戏其实是跨平台的游戏,在我要汉化这款游戏的时候Windows平台的游戏已经有3dm的汉化版本。为了提高汉化速度和减少工作量,就可以采用使用3dm已经汉化的资源替换iOS版本的资源的方式进行汉化。 汉化后效果(iPad截图):

 

Continue Reading