Skip to content

Instantly share code, notes, and snippets.

View s7ephen's full-sized avatar

Stephen A. Ridley s7ephen

View GitHub Profile
@s7ephen
s7ephen / GhettoCrypt
Created October 11, 2017 04:43
Use the openssl binary/version on OSX to do symmetric crypto.
#!/bin/bash
# Use the openssl binary/version on OSX to do symmetric crypto.
# [email protected]
if [ "$#" != "2" ]
then
echo "Usage: ghettocrypt.sh encrypt file_to_encrypt.zip" 1>&2
echo " OR" 1>&2
echo "ghettocrypt.sh decrypt file_to_decrypt.zip.enc" 1>&2
UydkZWYgdGhhbmcoKTpcbiAgICBpbXBvcnQgcmVxdWVzdHNcbiAgICByXyA9IHJlcXVlc3RzLmdldCgiaHR0cDovL3d3dy5hbWF6b24uY29tIilcbicKcDEKLg==
@s7ephen
s7ephen / record_screen
Created October 30, 2014 20:05
Record all (or a section of your screen) on your Mac
Launch QuickTime Player (it’s in your Applications folder). Now select New Screen Recording from the File menu, or type control-command-N. A small screen recording window will appear
Click the little triangle on the right side of the window to adjust microphone and mouse click options. When ready, click the record button in the center of the window. Click and drag a section of the screen to record part of the screen or just click to record the entire screen. Once you do that, click to start recording. Click the stop button that appears in the menu bar to stop recording.
Pretty easy, and the end result is a QuickTime movie you can use anywhere you’d expect (iMovie, YouTube, etc.)
@s7ephen
s7ephen / gist:2139962
Created March 20, 2012 19:09
bfishchat_client
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h> /* memset() */
#include <sys/time.h> /* select() */
@s7ephen
s7ephen / gist:1097875
Created July 21, 2011 18:43
inet_aton inet_ntoa in Ruby
>> VERSION
=> "1.8.7"
>> require 'ipaddr'
=> true
>> IPAddr.new("10.0.0.1").to_i
=> 167772161
>> IPAddr.new(167772161, Socket::AF_INET).to_s
=> "10.0.0.1"
>> # To look around to find this, its just a matter of:
#!/usr/bin/ruby
# This code is to demonstrate these very important things to remember about Ruby:
#
# 1. Classes are also Objects in Ruby.
# 2. Every Object in Ruby has its own Singleton Class (or "Meta Class" or "Eigen
# Class"
# 3. In other languages you may be familiar with the idea that each Object
# Instance is unique, but in Ruby, each Object Instance has its own unique
# Class definition, unique to JUST THAT instance. This is called the Object's
# singleton class.
@s7ephen
s7ephen / Powershell change wallpaper
Created November 24, 2010 17:20
How to change the desktop wallpaper from powershell.
set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value accipiter.png
@s7ephen
s7ephen / Viewing Android binary XML (kinda)
Created October 1, 2010 18:06
Viewing Android binary XML (kinda)
Below is the tool (and its arguments) for reading/viewing the data inside Android's binary XML format.
./aapt l -a /data/apps/freeware/android/sl4a_r1.apk <-- gives a list of assets in the package.
./aapt d xmlstrings /data/apps/freeware/android/sl4a_r1.apk res/xml/preferences.xml <-- the path to this was taken from the list of assets printed above
./aapt d xmltree /data/apps/freeware/android/sl4a_r1.apk res/xml/preferences.xml <-- the path to this was taken from the list of assets printed above
=== ACTUALLY RUNNING IT ===
navi-two:tools s7ephen$ pwd
/Users/s7ephen/Desktop/android-sdk-mac_86/platforms/android-7/tools
>>> hex(int(bin(0x55),2))
'0x55'
>>> bin(0x55)
'0b1010101'
>>> type(bin(0x55))
<type 'str'>
>>>
@s7ephen
s7ephen / user32.rb
Created October 27, 2009 21:01
user32 from ruby
#!/usr/bin/env ruby
# == User32.rb
# PoC for how to interface with the User32 subsystem on windows
# aka: Control windows and stuff, simulate keyboard/mouse.
# This is particularly useful for app pentesting because you can use this
# to "enable" disabled menus/buttons etc.
# This will demonstrate rudimentary window messaging via the user32 API
# to control Calc.exe
#
# == Author