Skip to content

Instantly share code, notes, and snippets.

View KINGSABRI's full-sized avatar
♠️

KING SABRI KINGSABRI

♠️
View GitHub Profile
@KINGSABRI
KINGSABRI / noawk.rb
Last active August 24, 2016 11:48
String parser for "key :value" text file
#!/usr/bin/env ruby
#
# KING SABRI | @KINGSABRI
# Usage:
# ruby noawk.rb file.txt
#
# One-liner:
# ruby -e 'h={};File.read("text.txt").split("\n").map{|l|l.split(":", 2)}.map{|k, v|k.strip!;v.strip!; h[k] ? h[k] << v : h[k] = [v]};h.each {|k, v| puts "#{k}:\t#{v.join(", ")}"}'
#
#!/usr/bin/env ruby
#
#
require 'nokogiri'
# Validate an XML document against a Schema.
doc = Nokogiri::XML(File.read "cve-small.xml")
items = doc.search("item")
@KINGSABRI
KINGSABRI / dlls.rb
Created August 2, 2016 19:09 — forked from tetsuyainfra/dlls.rb
Windows の Ruby が開いてる dll の一覧を見る@fiddle版
require "fiddle/import"
require 'fiddle/types'
# オリジナル(Win32APIライブラリを使う版)はこちら
# https://rubyist.g.hatena.ne.jp/edvakf/20110405/1301973681
module WIN32API
extend Fiddle::Importer
dlload 'C:\\Windows\\System32\\kernel32.dll'
include Fiddle::Win32Types
extern 'DWORD GetCurrentProcessId()'
@KINGSABRI
KINGSABRI / net_http_digest_auth.rb
Created July 14, 2016 02:14 — forked from n8agrin/net_http_digest_auth.rb
HTTP Digest Auth for Ruby's net/http
# Support for http digest auth
# Discovered here: http://johan.bingodisk.com/public/code/net_digest_auth.rb
require 'digest/md5'
require 'net/http'
module Net
module HTTPHeader
@@nonce_count = -1
CNONCE = Digest::MD5.new("%x" % (Time.now.to_i + rand(65535))).hexdigest
### Keybase proof
I hereby claim:
* I am KINGSABRI on github.
* I am kingsabri (https://keybase.io/kingsabri) on keybase.
* I have a public key whose fingerprint is 288B EDC0 AACE 09C2 F865 4605 489B 2AEE 3B5C 5ACF
To claim this, I am signing this object:
@KINGSABRI
KINGSABRI / flippy.rb
Last active June 7, 2021 17:11
Ruby script to flip text upside down, reverse text and opposite
#!/usr/bin/ruby
# KING SABRI | @KINGSABRI
# Flipp, Upsite down text
subs = {
" " => " ",
"a" => "ɐ",
"b" => "q",
"c" => "ɔ",
"d" => "p",
"e" => "ǝ",
# Reproduce
## Terminal 1
ncat -lvp 5555 -e /bin/sh
## Terminal 2
ncat -v localhost 5555
# Python pty spawn
python -c 'import pty; pty.spawn("/bin/bash")'
# test interactive mode with interactive linux command
@KINGSABRI
KINGSABRI / java_ruby_unsigned_int_to_hex.rb
Created March 29, 2016 16:40 — forked from vishaltelangre/java_ruby_unsigned_int_to_hex.rb
ruby converting an unsigned int to hexadecimal (java-like implementation)
# In Java, the following expression
# Integer.toHexString(1286933134)
# produces:
# "4cb50a8e"
# and
# Integer.toHexString(-1286933134)
# produces:
# "b34af572"
# ref doc: http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toHexString(int)
@KINGSABRI
KINGSABRI / ssh-fwtunnel.rb
Created October 7, 2015 12:42
ssh forward tunnel
#!/usr/bin/evn ruby
require 'net/ssh'
Net::SSH.start("127.0.0.1", 'fish', :password => 'fisheye', :verbose => :debug) do |ssh|
# Forward connections coming on port 3333 to port 3389 of attacker.zone
ssh.forward.local('0.0.0.0', 3333, "172.16.16.136", 80)
puts "[+] Starting SSH port forward tunnel"
ssh.loop { true }
end
@KINGSABRI
KINGSABRI / Selenium Cheat Sheet.md
Created September 24, 2015 05:34 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">