PE文件解析 基础篇

前言 - 之前学习了PE格式,为了更好的理解,决定写一个类似LoadPE的小工具。 编译器是VS2015,采用MFC框架。 此系列文章采用边介绍知识点,边写代码的形式,以免变的无聊丧失兴趣。 PE知识请参照《加密与解密》第10章。 PE文件格式1. PE文件基本概念 - PE文件是windows系……

Continue reading

批量提取公众号文章的python脚本

如何获取?http://xingyue.artizen.me coding:utf-8 import json import pprint links_array = [] with open('msg.txt',encoding='utf-8') as file: for line in file: s = json.loads(line) [links_array.append(i['link']) for i in s['app_msg_list']] with open('link.txt','w') as f : [f.write(l + '\n') for l in links_array]……

Continue reading

C++ 标准库中缺少的字符串函数:`starts_with` 和 `ends_with`

C++ 标准模板库的 std::string 很好很强大,但是并没有提供判断一个字符串是否以另一个字符串开始/结束的接口。这里为 std::basic_string<charT> 提供这两个接口。 //string_predicate.hpp #include <string> namespace std { template <typename charT> inline bool starts_with(const basic_string<charT>& big, const basic_string<charT>& small) { if (&big == &small) return true; const typename basic_string<charT>::size_type big_size = big.size(); const typename basic_string<charT>::size_type small_size = small.size(); const bool valid_ = (big_size >= small_size); const bool starts_with_ = (big.compare(0, small_size, small) == 0); return valid_ and starts_with_; } template <typename charT> inline bool ends_with(const basic_string<charT>& big, const basic_string<charT>& small) { if (&big == &small) return true; const typename basic_string<charT>::size_type big_size = big.size(); const……

Continue reading

Linux统计文件夹下的文件数目

Linux下有三个命令:ls、grep、wc。通过这三个命令的组合可以统计目录下文件及文件夹的个数。 统计当前目录下文件的个数(不包括目录) $ ls -l | grep "^-" | wc -l 统计当前目录下文件的个数(包括子目录) $ ls -lR| grep "^-" | wc -l 查看某目录下文件夹(目录)的个数(包括子目录) ls -lR | grep "^d" | wc -l 命令解析……

Continue reading

Linux 命令行下下载 Google Drive/Docs

转载自 https://onebox.site/archives/250.html 说到如何在Linux命令行下下载Google网盘(云端硬盘)的文件,第一个想到的应该是gdrive(prasmussen/gdrive),这个脚本可以下载、上传、同步等功能,当然需要事先命令gdrive about关联网盘,显然适合自己使用。 如果说要下载别人分享的文件呢?直……

Continue reading

ubuntu 搭建S3服务 mino单机和集群集群

搭建mino 集群 单机版 # 新建用户 sudo useradd -r minio-user -s /sbin/nologin sudo chown -R minio-user:minio-user /usr/local/bin/minio sudo mkdir /usr/local/share/minio sudo chown -R minio-user:minio-user /usr/local/share/minio sudo mkdir /etc/minio sudo chown -R minio-user:minio-user /etc/minio # 记得替换 MINIO_VOLUMES cat /etc/default/minio # Local export path. MINIO_VOLUMES=&quot;/tmp/minio/&quot; # Use if you want to run Minio on a custom port. MINIO_OPTS=&quot;--address :443&quot; EOT # 替换key cat /etc/default/minio # Access Key of the server. MINIO_ACCESS_KEY=Server-Access-Key # Secret key of the server. MINIO_SECRET_KEY=Server-Secret-Key EOT # 下载安装service文件 ( cd /etc/systemd/system/; curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service ) # 记得替换 /etc/systemd/system/minio.service # 中user和group # 重载配置 systemctl daemon-reload……

Continue reading

简单的GDI操作

简单的GDI操作 窗口程序的本质 :GUI GDI GDI: Graphics Device Interface,图形设备接口,这是Windows提供的一组用于绘制图像的API GUI: Graphical User Interface,图形用户界面,是指用户操作软件的界面方式,以区别于字符方式 说白了 GDI是一套实打实的接口,真实存在 GUI只是一个概念 GDI 图像设备接口(……

Continue reading

消息机制与模拟消息

消息机制与模拟消息 消息机制 硬件产生事件 被操作系统捕获,封装成消息 操作系统发送到系统消息队列 再由操作系统由系统消息队列发送到 对应的线程内核对象中的线程消息队列 线程消息队列处理完毕后,将时间送回操作系统 由操作系统调用窗口回调函数 => WindowProc() 线程消息队列 处理 GetMessage() => 取出消息 DispathMessage() => 把消息再送回系统中系……

Continue reading

新建一个窗口程序

新建一个窗口程序 消息机制 创建窗口的几个步骤 创建窗口类 注册窗口类 创建窗口 显示窗口 构建消息循环 创建过程 demo : https://github.com/luodaoyi/cpp_code/tree/master/MemoryInjectTool/CreateWindows //1 创建窗口类型模板 WNDCLASS wndclass = { 0 }; wndclass.lpszClassName = className; //名字 wndclass.hbrBackground = (HBRUSH)COLOR_BACKGROUND; //背景画笔句柄 wndclass.hInstance = hInstance; //窗口过程的实例句柄 wndclass.lpfnWndProc = WndProc; //窗口过程函数 //2 注册窗口 RegisterClass(&wndclass); //3 创建窗口 HWND hwindows = CreateWindow(className, TEXT("MYWINDOWS"), WS_OVERLAPPEDWINDOW, 500, 300, 300, 250, NULL, NULL, hInstance,NULL); //创建窗口……

Continue reading

office2016 visio2016 project2016零售版转换vol版bat

在http://msdn.itellyou.cn/网站上下载的是office2016是零售版的,转换为vol,将下列文本另存为bat文件,运行即可 @ECHO OFF&PUSHD %~DP0 setlocal EnableDelayedExpansion&color 3e & cd /d "%~dp0" title office2016 retail转换vol版 %1 %2 mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :runas","","runas",1)(window.close)&goto :eof :runas if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16" if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16" :WH cls echo. echo 选择需要转化的office版本序……

Continue reading