Skip to content

Instantly share code, notes, and snippets.

View KINGSABRI's full-sized avatar
♠️

KING SABRI KINGSABRI

♠️
View GitHub Profile
@sonots
sonots / gist:8923003
Last active February 14, 2017 11:35
how to use net/http in muliti threads
require 'net/http'
require 'uri'
host = "localhost"
port = 5125
path = "/api/hoge/hoge/hoge"
body = URI.encode_www_form({'number'=>0, 'mode'=>'gauge'})
# 1)
@client = Net::HTTP.new(host, port)
# @client.set_debug_output(STDOUT)
@mubix
mubix / brutelist.rb
Created February 20, 2014 04:54
Just charset brute force script
#!/usr/bin/env ruby
#
## Brute code stolen form: https://gist.github.com/petehamilton/4755855
#
def result?(sub)
puts sub
1 == 2
@mubix
mubix / powershellpopup.ps1
Created January 12, 2015 20:22
Powershell Popups, proxy aware and auth aware
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName + "\" + [Environment]::UserName,[Environment]::UserDomainName);
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};
$wc = new-object net.webclient;
$wc.Proxy = [System.Net.WebRequest]::DefaultWebProxy;
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials;
$wc.credentials = new-object system.net.networkcredential($cred.username, $cred.getnetworkcredential().password, '');
$result = $wc.downloadstring('https://172.16.102.163');
@jstorimer
jstorimer / port_scanner.rb
Created August 30, 2012 03:40
Simple, parallel port scanner in Ruby built with connect_nonblock and IO.select.
require 'socket'
# Set up the parameters.
PORT_RANGE = 1..512
HOST = 'archive.org'
TIME_TO_WAIT = 5 # seconds
# Create a socket for each port and initiate the nonblocking
# connect.
sockets = PORT_RANGE.map do |port|
@KINGSABRI
KINGSABRI / ex-ssh-pty.rb
Created August 28, 2012 16:04
ex. SSH with real PTY
require 'net/ssh'
host = "the.host"
user = "joe"
su_user = "bob"
password = "password"
commands = ["cd /", "pwd", "ls -l", "exit"]
finished = ("%08x" * 8) % Array.new(8) { rand(0xFFFFFFFF) }
@JoshCheek
JoshCheek / evolution
Created August 2, 2016 17:47
Terminal L-System in a tweet
Posted here https://twitter.com/josh_cheek/status/760519587758690304
Previously https://twitter.com/josh_cheek/status/667501443226558464
Based on http://algorithmicbotany.org/papers/abop/abop-ch1.pdf
ruby -e 's = "F-F-F-F"; 3.times { s = s.gsub /f/i, "F" => "FF-F-F-F-FF" };
dirs = [" \e[2D\e[A", " ", " \e[2D\e[B", " \e[4D"].map { |s| s * 2 }
print "\e[H\e[2J\e[60;20H\e[45m" # clear and "center"
s.each_char { |c| c == "F" ? print("\e[45m",dirs[0]) : c == "f" ? print("\e[49m", dirs[0]) : c == "-" ? dirs.rotate!(1) : c == "+" ? dirs.rotate!(-1) : :noop }
puts'
@shinaisan
shinaisan / test.rb
Created December 17, 2012 14:58
A PE header reading sample using BinData Ruby gem.
require 'bindata'
require 'pp'
class ImageDosHeader < BinData::Record
endian :little
uint16 :e_magic, :check_value => 0x5A4D # MZ
uint16 :e_cblp
uint16 :e_cp
uint16 :e_crlc
uint16 :e_cparhdr
@spalladino
spalladino / san.msupn.rb
Last active March 20, 2018 13:38
Extracting Subject Alternative Name Other Name (1.3.6.1.4.1.311.20.2.3) from Microsoft authorization client certificates
cert = OpenSSL::X509::Certificate.new(certificate_string)
subject_alt_name = cert.extensions.find {|e| e.oid == "subjectAltName"}
# Parse the subject alternate name certificate extension as ASN1, first value should be the key
asn_san = OpenSSL::ASN1.decode(subject_alt_name)
raise "Expected ASN1 Subject Alternate Name extension key to be subjectAltName but was #{asn_san.value[0].value}" if asn_san.value[0].value != 'subjectAltName'
# And the second value should be a nested ASN1 sequence
asn_san_sequence = OpenSSL::ASN1.decode(asn_san.value[1].value)
#include <Windows.h>
#include <cassert>
int
main(int argc, char **argv)
{
(void)argc;
(void)argv;
// التعليمات مولّدة من هذا الكود:
@rekkusu
rekkusu / extconf.rb
Last active August 28, 2018 18:05
Run shellcode from Ruby
require 'mkmf'
create_makefile('shellcode')