Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
jeffgeiger / listen.py
Created September 1, 2020 20:50 — forked from echojc/listen.py
Quick 'n' dirty Python script to listen on a port and do nothing with the connection, simulating a server that allows you to connect but does not reply.
#!/usr/bin/python
import socket
import sys
if (len(sys.argv) != 2 or not sys.argv[1].isdigit()):
print 'Usage: listen <port>',
exit()
p = int(sys.argv[1])
l = []
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@jeffgeiger
jeffgeiger / asciiputsonglasses
Created June 25, 2019 22:12 — forked from staringispolite/asciiputsonglasses
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
@jeffgeiger
jeffgeiger / gist:c11fd13073d9c9a18ae5958626928203
Created September 12, 2018 15:15
RockNSM 2.1 - Add suricata rules on an offline install
# Add the offline rules file as a source:
sudo suricata-update add-source "Local Rules" "file:///srv/rocknsm/support/emerging.rules-suricata.tar.gz"
# Check that we're not going to go screaming at the internet for an update
sudo suricata-update list-enabled-sources
# You should see this:
# Enabled sources:
# - Local Rules
@jeffgeiger
jeffgeiger / client.py
Created July 31, 2018 14:42 — forked from yoavram/client.py
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
@jeffgeiger
jeffgeiger / ftp.py
Created July 31, 2017 22:38
Simple python FTP server
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
authorizer = DummyAuthorizer()
authorizer.add_user("user", "12345", "/tmp", perm="elradfmw")
authorizer.add_anonymous("/tmp")
handler = FTPHandler
handler.authorizer = authorizer
server = FTPServer(("0.0.0.0", 21), handler)
server.serve_forever()

Grab the main page with all the links:
curl https://slackmojis.com/ > emoji

Open file in vim and run the following commands:

v/src=/d
%s/^.*http:/http:/g"
%s/?.*$//g
@jeffgeiger
jeffgeiger / SSH_2FA_Google.md
Last active March 13, 2018 03:40
Quick and dirty setup guide for Google Auth 2FA on CentOS7
## Build RPM as per https://github.com/google/google-authenticator-libpam/blob/master/contrib/README.rpm.md
# Do this elsewhere, you don't want dev tools on a box you're trying to secure.  ;) 
# Also note, the repo has moved, so you need to adjust the git path:
# https://github.com/google/google-authenticator-libpam

sudo yum install epel-release -y
sudo yum install qrencode qrencode-devel qrencode-libs
sudo yum install google-authenticator-1.03-1.el7.centos.x86_64.rpm
google-authenticator #per-user setup

README

This is a CentOS-themed /etc/issue w/ hooks to update IP address and OS release upon ifup/ifdown. My motivation was that I was tired of logging into an otherwise headless box just to find the IP of the system so I can SSH to it.

Note
The issue.in file actually contains control characters to do the color in the text. The easiest way to preserve that is to clone this gist and run the install.sh script w/ sudo, which will copy the file and set the SELinux

Keybase proof

I hereby claim:

  • I am jeffgeiger on github.
  • I am jeffgeiger (https://keybase.io/jeffgeiger) on keybase.
  • I have a public key whose fingerprint is 3EE0 89DC 9EA2 CB58 703C 658F 67F2 38AC C74F 83F8

To claim this, I am signing this object: