Closed postmodern closed 1 year ago
Add a porting guide on how to convert pwnlib scripts into ronin ruby scripts. Try to find the ronin equivalents for the various pwnlib APIs. Show examples from ronin-support, ronin-code-asm, ronin-payloads, and ronin-exploits.
Ronin::Support::Binary::Buffer
IO.popen
tcp_connect
ssl_connect
tls_connect
udp_connect
tcp_server
ssl_server
tls_server
udp_server
Ronin::Support::Network::HTTP::UserAgents
bits_str
int.to_s(2)
b64d
string.base64_decode
b64e
string.base64_encode
enhex
string.hex_encode
hexdump
string.hexdump
File.hexdump
io.hexdump
hexdump_iter
Hexdump::Hexdump#each_line
isprint
string.printable?
Chars::PRINTABLE =~ string
js_escape
string.js_escape
js_unescape
string.js_unescape
unhex
string.hex_decode
urldecode
/
urlencode
string.uri_encode
xor
string.xor(other_string)
md5filehex
File.md5(path)
md5sumhex
string.md5
sha1filehex
File.sha1(path)
sha1sumhex
string.sha1
sha256filehex
File.sha256(path)
sha256sumhex
string.sha256
sha512filehex
File.sha512(path)
sha512sumhex
string.sha512
chained
return enum_for(__method__,...) unless block_given?
consume
cycles
array.cycle(n)
bruteforce
Chars.alpha_numeric.strings_of_length(n).find { |str| ... }
flatten
array.flatten
group
array.each_slice(n)
iter_except
array.each
lookahead
enum.take(n)
nth
pad
pairwise
enum.each_cons(2)
powerset
require 'combinatorics/power_set'
array.power_set
quantify
enum.count { |i| ... }
random_combination
array.combination(2).to_a.sample
random_permutation
array.permutation.to_a.sample
random_product
array1.product(array2).sample
repeat_func
Array.new(n) { |i| func(obj) }
roundrobbin
tabulate
(1..4).map { |i| ... }
(1..4).map(&method(:func))
take
unique_everseen
enum.uniq
unique_justseen
unique_window
concat
array.concat
concat_all
findall
each_slice(n)
ordlist
string.bytes
partition
unordlist
array.map(&:chr).join
align
array.map
int.round
align_down
binary_ip
IPAddr.new(ip).hton
mkdir_p
FileUtils.mkdir_p
read
File.binread(path)
File.read(path)
size
which
write
File.binwrite
File.write
pack
int.pack
p8
int.pack(:uint8)
int.chr
p16
int.pack(:uint16)
int.pack(:uint16_le)
int.pack(:uint16_be)
p32
int.pack(:uint32)
int.pack(:uint32_le)
int.pack(:uint32_be)
p64
int.pack(:uint64)
int.pack(:uint64_le)
int.pack(:uint64_be)
u8
string.unpack1(:uint8)
u16
string.unpack1(:uint16)
string.unpack1(:uint16_le)
string.unpack1(:uint16_be)
u32
string.unpack1(:uint32)
string.unpack1(:uint32_le)
string.unpack1(:uint32_be)
u64
string.unpack1(:uint64)
string.unpack1(:uint64_le)
string.unpack1(:uint64_be)
unpack
string.unpack1
unpack_many
string.unpack
[:uint, n]
Add a porting guide on how to convert pwnlib scripts into ronin ruby scripts. Try to find the ronin equivalents for the various pwnlib APIs. Show examples from ronin-support, ronin-code-asm, ronin-payloads, and ronin-exploits.
Ronin::Support::Binary::Buffer
IO.popen
tcp_connect
,ssl_connect
,tls_connect
,udp_connect
.tcp_server
,ssl_server
,tls_server
,udp_server
.Ronin::Support::Network::HTTP::UserAgents
(also mention ronin-web-user_agents for generating random realistic User-Agent strings).bits_str
->int.to_s(2)
b64d
->string.base64_decode
b64e
->string.base64_encode
enhex
->string.hex_encode
hexdump
->string.hexdump
/File.hexdump
/io.hexdump
hexdump_iter
->Hexdump::Hexdump#each_line
?isprint
->string.printable?
/Chars::PRINTABLE =~ string
js_escape
->string.js_escape
js_unescape
->string.js_unescape
unhex
->string.hex_decode
urldecode
-> string.uri_decode/
string.uri_unescape`urlencode
->string.uri_encode
xor
->string.xor(other_string)
md5filehex
->File.md5(path)
md5sumhex
->string.md5
sha1filehex
->File.sha1(path)
sha1sumhex
->string.sha1
sha256filehex
->File.sha256(path)
sha256sumhex
->string.sha256
sha512filehex
->File.sha512(path)
sha512sumhex
->string.sha512
chained
->return enum_for(__method__,...) unless block_given?
consume
-> ????cycles
->array.cycle(n)
bruteforce
->Chars.alpha_numeric.strings_of_length(n).find { |str| ... }
flatten
->array.flatten
group
->array.each_slice(n)
iter_except
->array.each
(this is how enumerators work by default).lookahead
->enum.take(n)
nth
-> ????pad
-> ????pairwise
->enum.each_cons(2)
powerset
->require 'combinatorics/power_set'
andarray.power_set
.quantify
->enum.count { |i| ... }
random_combination
->array.combination(2).to_a.sample
random_permutation
->array.permutation.to_a.sample
random_product
->array1.product(array2).sample
repeat_func
->Array.new(n) { |i| func(obj) }
roundrobbin
-> ????tabulate
->(1..4).map { |i| ... }
/(1..4).map(&method(:func))
take
->enum.take(n)
unique_everseen
->enum.uniq
unique_justseen
-> ????unique_window
-> ????concat
->array.concat
concat_all
->array.concat
findall
-> ????group
->each_slice(n)
ordlist
->string.bytes
partition
-> ????unordlist
->array.map(&:chr).join
align
-> ???? (maybearray.map
withint.round
?)align_down
-> ???? (maybearray.map
withint.round
?)binary_ip
->IPAddr.new(ip).hton
mkdir_p
->FileUtils.mkdir_p
read
->File.binread(path)
/File.read(path)
size
-> ????which
-> ????write
->File.binwrite
/File.write
pack
->int.pack
(but with a ctype symbol instead of endianness, wordsize, endianness)p8
->int.pack(:uint8)
/int.chr
p16
->int.pack(:uint16)
/int.pack(:uint16_le)
/int.pack(:uint16_be)
p32
->int.pack(:uint32)
/int.pack(:uint32_le)
/int.pack(:uint32_be)
p64
->int.pack(:uint64)
/int.pack(:uint64_le)
/int.pack(:uint64_be)
u8
->string.unpack1(:uint8)
u16
->string.unpack1(:uint16)
/string.unpack1(:uint16_le)
/string.unpack1(:uint16_be)
u32
->string.unpack1(:uint32)
/string.unpack1(:uint32_le)
/string.unpack1(:uint32_be)
u64
->string.unpack1(:uint64)
/string.unpack1(:uint64_le)
/string.unpack1(:uint64_be)
unpack
->string.unpack1
(but with a ctype symbol instead of endianness, wordsize, endianness)unpack_many
->string.unpack
(but with a[:uint, n]
instead of endianness, wordsize, endianness)