Skip to content

Instantly share code, notes, and snippets.

View cwshu's full-sized avatar

Jim Shu cwshu

  • Hsinchu, Taiwan
View GitHub Profile
@cwshu
cwshu / tmp.py
Last active August 29, 2015 14:04
get false command(return 0) output by check_output
import subprocess as sub
out = sub.check_output("diff NEWS NEWS.old || true", shell=True)

ethernet

  • ifconfig eth0 <IP> netmask <netmask>
  • route add default gw <gateway>
  • edit /etc/resolv.conf
    • nameserver <DNS>
variable example
  • <IP> = 192.168.1.10
  • <netmask> = 255.255.255.128
@cwshu
cwshu / path
Created August 20, 2014 16:14
valgrindrr replay bug, tracing path
m_main.c:1832:VG_(split_up_argv)
m_commandline.c:258:VG_(RR_ClientCmdLine)
m_recordreplay.c:244:PROCESS_LOGENTRY
m_coregrind/m_recordreplay/priv_recordreplay.h:132:ML_(readFromLog)
replay.c:164:VG_(malloc)(NULL, len+1)
@cwshu
cwshu / gist:2c849985b18d7f7182d6
Last active August 29, 2015 14:05
linuxmint add user
- sudo useradd testing -m -s /bin/bash
- 建立帳號, username 為 testing
- sudo passwd testing
- 給 testing 密碼
@cwshu
cwshu / gist:3f6c25647a4a30e08195
Created January 30, 2015 09:53
Ghost - glibc buffer overflow vulnerability
ghost: glibc 的 gethostbyname(解 domain name 的 function) 出現 buffer overflow 的 bug,可以讓 attacker 完整控制這支程式
補救方法是 update glibc,而且將所有有用到 glibc 的 process 重新啟動。
update patch guide [centos]: https://www.centosblog.com/critical-glibc-remote-vulnerability-exploit-ghost-patch-glibc-now/
centos6 的 glibc patch 版本號: http://lists.centos.org/pipermail/centos-announce/2015-January/020907.html
centos7 的 glibc patch 版本號: http://lists.centos.org/pipermail/centos-announce/2015-January/020908.html
#include <iostream>
using namespace std;
int f(int a=10);
int main(){
cout << f() << endl;
cout << f(100) << endl;
}
#!/usr/bin/env python3
"""
transform the diff program output format to "git diff --stat" style.
./diff_stat.py [diff_file]
"""
import sys
def get_fname(diff_data):
"""
#!/usr/local/bin/python2
import cgi
import subprocess as sp
html_template = """<html>
<head>
<title> Web Shell </title>
</head>
<body>

linux guest on linux-kvm-arm host on armv8 FoundationModel

all you need

  1. FoundationModel armv8 simulator
  2. linux-kvm-arm kernel (including dtb(device tree blob))
    • kernel config
  3. linux root file system: host.img && guest.img
  4. userspace virtualization tool: qemu/kvm-tool
  5. FoundationModel boot wrapper