Skip to content

Instantly share code, notes, and snippets.

View Mithrilwoodrat's full-sized avatar
🎯
Focusing

xiaoxianyu Mithrilwoodrat

🎯
Focusing
View GitHub Profile
@Mithrilwoodrat
Mithrilwoodrat / xss_firefox_test
Created July 7, 2015 15:55
Code from HTML5 Security Cheatsheet
document.write('<form id="test"></form><button form="test" formaction="javascript:alert(1)">X</button>')
@Mithrilwoodrat
Mithrilwoodrat / Description.md
Created April 14, 2016 09:16 — forked from juanje/Description.md
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
#!/bin/bash
output=$(gsettings get org.gnome.desktop.background show-desktop-icons)
echo "show-desktop-icons is $output"
if [ "$output" == "true" ]; then
gsettings set org.gnome.desktop.background show-desktop-icons false
echo "hide"
else
gsettings set org.gnome.desktop.background show-desktop-icons true
echo "show"
fi
@Mithrilwoodrat
Mithrilwoodrat / es.py
Last active March 26, 2018 09:22
python script to make curl cmd for request elasticsearch
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
## usage: chmod +x es.py & mv es.py /usr/bin/es
## edit file to custom server
import os
from optparse import OptionParser
from urllib2 import urlparse
SERVER = "http://127.0.0.1:9200/"
METHODS = ["GET", "PUT", "POST", "DELETE"]
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
for d in v:
for result in find(key, d):
@Mithrilwoodrat
Mithrilwoodrat / install-pypy.sh
Created October 26, 2016 06:59 — forked from baoshan/install-pypy.sh
Install PyPy on CentOS
# yum list \*openssl\*
yum install -y openssl098e
yum install -y zlib
ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8
ln -s /lib64/libbz2.so.1 /lib64/libbz2.so.1.0
wget https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2
tar -xf pypy-1.8-linux64.tar.bz2
cp -r pypy-1.8 /opt
ln -s /opt/pypy-1.8/bin/pypy /usr/local/bin
@Mithrilwoodrat
Mithrilwoodrat / snort.strace
Created May 19, 2018 11:07
snort.strace in WSL kali
20968 execve("/usr/sbin/snort", ["snort", "-ilo"], 0x7fffdb9b5900 /* 15 vars */) = 0
20968 brk(NULL) = 0x1c0e000
20968 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20968 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
20968 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
20968 fstat(3, {st_mode=S_IFREG|0644, st_size=35094, ...}) = 0
20968 mmap(NULL, 35094, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f848ac5c000
20968 close(3) = 0
20968 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20968 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libdumbnet.so.1", O_RDONLY|O_CLOEXEC) = 3
@Mithrilwoodrat
Mithrilwoodrat / WSL-ssh-server.md
Created June 22, 2018 14:44 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Uninstall and reinstall the ssh server using the following commands:
    1. sudo apt remove openssh-server
    2. sudo apt install openssh-server
  2. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
  3. Change UsePrivilegeSeparation to no
@Mithrilwoodrat
Mithrilwoodrat / Scapy_TcpSession.py
Created August 26, 2018 11:56 — forked from N0dr4x/Scapy_TcpSession.py
Simple Scapy TCP Session
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Author: N0dr4x (n0dr4x@protonmail.com)
'''
Simple Scapy TCP Session class that provide ability
to :
- execute the 3-way handshake (eg. connect)
- properly close connection (->FIN/ACK, <-FIN/ACK, ->ACK )
- send automatic acknowledgment of received tcp data packet
  1. Install Notepad++ (check "set as default HTML editor" to replace Notepad in IE).
  2. Run Notepad++, update its plugins, and install "NppExec" via Plugins, Plugin Manager.
  3. Enter these scripts for Python debugging:

Press F6 to create a NppExec Execute script, save as "Run Python":

cd "$(CURRENT_DIRECTORY)"
py.exe "$(FILE_NAME)"