ls -an | grep <my life>
TOP
post @ 2020-05-13

初来乍到

如果你有幸看到这

Hello World。

整站主体语言是中文/英文。

整个博客涉及的内容不限,玩什么,尝试什么,就会写下来。

如果你在阅览后有建议或者发现错误,请联系我,多谢。


本博客网站维护使用大致由下列工具与技术组成

├── Local
│ ├── Typora (撰写与维护文本内容)
│ ├── PicGo (图床,图片内容)

├── Online
│ ├── Github Pages(白嫖服务器)
│ ├── Hexo (博客系统,SSH deploy部署,Hexo-admin 偶尔管理)
│ ├── hexo-theme-freemind (原生主题)
│ ├── FontAwesome(图标库)
│ └── Google Analytics

... ... ...
Read More →

持续记录

Alorithm Cheat Sheet|算法Cheat Sheet

技巧|Tricks


  • while(~scanf("%d", &n))

    ~是按位取反 scanf的返回值是输入值的个数 如果没有输入值就是返回-1 -1按位取反结果是0,即没有输入的时候退出循环

  • INF(最大值)设置

    INF设为0x7fffffff:32-bit int的最大值,但是注意越界操作,且不能满足“无穷大加一个有穷的数依然是无穷大”条件

    INF设为0x3f3f3f3f:多数情况下较为合理,它是很大的数,方便数组清零操作memset(a,0x3f,sizeof(a)),且满足无穷大加无穷大还是无穷大的条件

素数表生成|Prime number table


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void createprime(int n)
{
int m = sqrt(n + 0.5);
memset(vis, 0, sizeof(vis));
vis[1] = 1;
for (int i = 2; i <= m; i++)
if (!vis[i])
for (int j = i*i; j <= n; j += i)
vis[j] = 1;
}
/*生成1到n的素数表,里面的循环是把非素数置为1,素数为0,1特殊对待,直接赋值为1,变为非素数*/


bool isPrime_2(int num)
{
if (num == 1)return 0;
int tmp = sqrt(num);
for (int i = 2; i <= tmp; i++)
if (num %i == 0)
return 0;
return 1;
}
/*素数判断,对1特殊对待*/

快速幂|Binary Exponentiation


... ... ...
Read More →
post @ 2021-01-10

LeetCode - topics: Array (Part II)

54. Spiral Matrix

Given an m x n matrix, return all elements of the matrix in spiral order.

Example 1:

img
1
2
Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,2,3,6,9,8,7,4,5]

Example 2:

img
1
2
Input: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
Output: [1,2,3,4,8,12,11,10,9,5,6,7]

Constraints:

... ... ...
Read More →
post @ 2021-01-10

LeetCode - topics: Array (Part I)

1. Two Sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Example 1:

1
2
3
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].

Example 2:

1
2
Input: nums = [3,2,4], target = 6
Output: [1,2]

Constraints:

... ... ...
Read More →
post @ 2020-12-12

Convenient for code write

爬虫代码初始化模板


作用:requests爬虫脚本初始化代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import re
import urllib
import requests
from bs4 import BeautifulSoup

url=""
headers={}
proxies={
# 'http': 'socks5://xxxx:5555',
# 'https': 'socks5://xxxx:5555'
}

result = requests.get(url_fix, proxies=proxies, headers=headers)
soup = BeautifulSoup(result.content.decode('utf-8'), 'lxml')
target = soup.find('div')

修正url中的#


作用:防止待爬取目标的url中具有的#等特殊字符对爬虫进行干扰

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sharp_fix(url):
"""
the sharp (#) will incur some troubles in url
param: url

"""
if url.find('#') >= 0:
strs = url.split('#')
if is_chinese(strs[1]):
fix = urllib.parse.quote(strs[1])
fix = strs[0] + '%23' + fix
return fix
return url
return url

判断字符串否包含中文

... ... ...
Read More →
post @ 2020-12-11

Python实用项目收录|NICE projects

1. rembg


rembg 是使用 Python 实现的用于移除背景图片的工具,要求 Python 3.8 或更高版本,支持批量操作,使用方式比较灵活,可以直接使用命令行、作为服务运行、在 docker 中使用,还可以作为库调用。

GitHub - danielgatis/rembg

image-20201211175945979

2. SkyAR


SkyAR 是一种基于视觉的视频天空置换和协调方法,可以在可控风格的视频中自动生成逼真和生动的天空背景

GitHub - jiupinjia/SkyAR

... ... ...
Read More →

2020.11.30-12.6一周安全知识动态

转自image-20200929114557052

CTF相关

•hitcon-ctf-2020

1
2
https://github.com/orangetw/My-CTF-Web-Challenges/tree/master/hitcon-ctf-2020
hitcon 2020 web题目源码

•angelboy hitcon writeup

1
2
https://github.com/scwuaptx/CTF/tree/master/
2020-writeup/hitcon

漏洞挖掘相关

•healer

1
2
https://github.com/SunHao-0/healer
kernel fuzzer inspired by syzkaller. Written in Rust
... ... ...
Read More →

2020.11.23-11.29一周安全知识动态

转自image-20200929114557052

IOT漏洞相关

•DualSense Reverse Engineering

1
2
https://sensepost.com/blog/2020/dualsense-reverse-engineering/
Sony DualSense无线控制器逆向分析

虚拟化逃逸漏洞相关

•MMU Virtualization Via Intel EPT – Index

1
2
https://revers.engineering/mmu-virtualization-via-intel-ept-index/
通过Intel EPT 实现MMU Virtualization

应用程序漏洞相关

•ImageMagick - Shell injection via PDF password

... ... ...
Read More →

2020.11.15-11.22一周安全知识动态

转自image-20200929114557052

IOT漏洞相关

•SD-PWN Part 2 — Citrix SD-WAN Center — Another Network Takeover

1
2
https://medium.com/realmodelabs/sd-pwn-part-2-citrix-sd-wan-center-another-network-takeover-a9c950a1a27c
Citrix SD-WAN Center漏洞分析

浏览器漏洞相关

•Modern attacks on the Chrome browser : optimizations and deoptimizations

1
2
https://doar-e.github.io/blog/2020/11/17/modern-attacks-on-the-chrome-browser-optimizations-and-deoptimizations/
doar-e 上新的关于v8工作机制以及漏洞Issue1016450分析的文章

•CVE-2020-17053: Use-After-Free IE Vulnerability

1
2
https://www.trendmicro.com/en_us/research/20/k/cve-2020-17053-use-after-free-ie-vulnerability.html
CVE-2020-17053 IE UAF漏洞分析
... ... ...
Read More →

2020.11.2-11.15一周安全知识动态

转自image-20200929114557052

漏洞挖掘相关

•Moving From Dynamic Emulation of UEFI Modules To Coverage-Guided Fuzzing of UEFI Firmware

1
2
https://labs.sentinelone.com/moving-from-dynamic-emulation-of-uefi-modules-to-coverage-guided-fuzzing-of-uefi-firmware/https://github.com/Sentinel-One/efi_fuzz
基于反馈的对UEFI固件的fuzz

•Fuzzing Go package using go-fuzz & libfuzzer

1
2
https://academy.fuzzinglabs.com/fuzzing-go-package-go-fuzz-libfuzzer
使用go-fuzz & libfuzzer 对go package进行fuzz

•2020 LLVM Developers’ Meeting: E. Stepanov “Memory tagging in LLVM and Android”

1
2
https://www.youtube.com/watch?v=tqG9pr1K5G8
llvm以及安卓中的内存标记技术

•Instrumenting Adobe Reader with Frida

... ... ...
Read More →
⬆︎UP