Skip to content

Instantly share code, notes, and snippets.

View Ignition's full-sized avatar

Gareth Andrew Lloyd Ignition

View GitHub Profile
Mar 27 10:29:09 li195-46 sshd[11343]: Invalid user gamma from 221.12.162.169
Mar 27 10:29:09 li195-46 sshd[11343]: pam_unix(sshd:auth): check pass; user unknown
Mar 27 10:29:09 li195-46 sshd[11343]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.12.162.169
Mar 27 10:29:11 li195-46 sshd[11343]: Failed password for invalid user gamma from 221.12.162.169 port 55656 ssh2
Mar 27 10:29:21 li195-46 sshd[11345]: Did not receive identification string from 221.12.162.169
@Ignition
Ignition / bad-phrases
Created April 12, 2011 16:23
Blog-p1-i1
Failed password
Did not receive identification string
@Ignition
Ignition / tofirewall.sh
Created April 12, 2011 16:55
Blog-p1-i2
#!/bin/sh
./badlist.sh | while read ipaddr
do
iptables -I INPUT -s ${ipaddr} -j DROP
done
iptables-save > /etc/iptables.rules
@Ignition
Ignition / did-it-work.sh
Created April 13, 2011 10:31
Blog-p1-i3
#!/bin/sh
zcat -f /var/log/auth.log* | grep -f bad-phrases | awk '{print $1,$2}' | sort -k 1,1M -k 2n | grep -vf white-list | uniq -c
## Output
#
# 953 Mar 13
# 1420 Mar 14
# 1783 Mar 15
# 1366 Mar 16
# 4572 Mar 17
@Ignition
Ignition / sshd_config
Created April 13, 2011 12:15
Blog-p1-i4
# Minimum authentication required, this should be a no
PermitEmptyPasswords no
# Root has full access to the machine, this is an attackers aim
# refuse ssh access and use sudo from another user account
PermitRootLogin no
# SSH daemon is easy to detect but most attackers assume port 22
# you can change to a non standard port, this will require the
# -p option on the ssh client in order to connect to correct port
@Ignition
Ignition / openmp-test.cpp
Created May 6, 2011 01:28
Test for Zena
#include <omp.h>
#include <cstdlib>
#include <iostream>
#include <list>
#include <time.h>
bool ompon = false;
std::list<int> intList;
const int N = 1000;
@Ignition
Ignition / text.c
Created January 23, 2012 23:14
Obfusticated
#include <stdio.h>
#define f(v,k) (((v << 2) | (~v >> 6)) ^ k)
int main(int argc, char *argv[]){
unsigned char c = 0x01, v, p[17] = {0x00}, k = 0x00, * t,
z[] = {0x87, 0xA3, 0x85, 0x96, 0x81, 0x90, 0x8C, 0xC4, 0xA4,
0xCA, 0xC5, 0xA9, 0x88, 0x8B, 0x9D, 0x80, 0xEE};
do{
t = z;
while (!((t - z) & 0x10)){
v = f(*t, k) ^ *((t++) + 1);
@Ignition
Ignition / future.cpp
Created October 29, 2012 14:58
Example of using future C++11
#include <iostream>
#include <future>
#include <thread>
int main()
{
// future from a packaged_task
std::packaged_task<int()> task([](){ return 7; }); // wrap the function
std::future<int> f1 = task.get_future(); // get a future
std::thread(std::move(task)).detach(); // launch on a thread
@Ignition
Ignition / gist:4155787
Created November 27, 2012 17:41
Using Oliver Kowalke's coroutines headers which will soon be in Boost
//https://gitorious.org/boost-dev/boost-dev, coroutine branch
//g++ -I path/to/boost-dev -std=c++11 code.cpp -static -L path/to/boost-dev/stage/lib/ -lboost_context
#include <boost/coroutine/all.hpp>
#include <boost/bind.hpp>
#include <boost/range.hpp>
#include <iostream>
#include <vector>
using namespace std;
@Ignition
Ignition / Instructions
Last active August 29, 2015 14:02
Configuration for Networking Computer Science, University of York
For Ubuntu/Debian, make sure your machine has its mac address registered so I can be put on the correct subnet. Ask CS support.
apt-get install ssh-client krb5-user libpam-krb5