Skip to content

Instantly share code, notes, and snippets.

View digizeph's full-sized avatar
🌟

Mingwei Zhang digizeph

🌟
View GitHub Profile
@digizeph
digizeph / ProgramCaller.java
Created February 5, 2014 08:17
Class to call external programs in Java and return the output String.
package util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Created by dan on 2/4/14.
*/
public class ProgramCaller {
@digizeph
digizeph / bgp_inspector.css
Created September 23, 2014 05:52
bgp_inspector css
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
.nicebox {
position: absolute;
text-align: left;
font-family: "Roboto", "Arial", sans-serif;
==Phrack Inc.==
Volume One, Issue 7, Phile 3 of 10
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following was written shortly after my arrest...
\/\The Conscience of a Hacker/\/
by
@digizeph
digizeph / create_users.sh
Created April 21, 2015 00:15
Copy two columns from the Google Sheet, users and key. Then replace all the '\t' with '='. Name it as credentials.txt. Run this script. It should create the users for you.
#!/bin/bash
while IFS='=' read USER KEY
do
if [ ! -d "/home/$USER" ]; then
sudo useradd -m $USER -g snal
echo created user $USER
sudo su - $USER -c "mkdir /home/$USER/.ssh; echo $KEY > /home/$USER/.ssh/authorized_keys; chmod 600 /home/$USER/.ssh/authorized_keys"
else
echo $USER already created
@digizeph
digizeph / get_logins.sh
Created April 23, 2015 05:54
Question: write a script to check who has logged in into your machine in the past month and log this information (usernames and last login) to a file.
#!/bin/bash
onemonth=`date --date="1 month ago" +"%y%m%d"`
last -F -R| head -n -2| cut -c1-9,27-46 | grep -v "reboot"| while read line; do date=`date -d "$(echo $line | awk '{ print $2" "$3" "$4" "$5 }')" +"%y%m%d"`; [[ $date -ge "$onemonth" ]] && echo $line; done > output.txt
@digizeph
digizeph / pom.xml
Created April 27, 2015 23:31
pom for building snal monitor
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cis-snal</groupId>
<artifactId>status-keeper</artifactId>
<version>1.0-SNAPSHOT</version>
#!/bin/bash
####
## read in fields
####
echo "Title:"
read -e title
echo ""
prefix length rib entries count
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 17
m count
8 17
9 5
10 36
11 92
12 239
13 418
14 908
15 1436
16 9984
@digizeph
digizeph / gist:b0c0debee268cb70c4da
Created September 2, 2015 02:27
IPv6 table dump prefix lengths count. RouteViews3 rib.20150901.0200.bz2
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java -Xmx2g -Didea.launcher.port=7536 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jce.jar: