This file contains hidden or 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
post '/crack_passwords' do | |
content_type :json | |
config = { | |
file: params['file'][:tempfile], | |
dictionary: params['dictionary'][:tempfile] | |
} | |
upc = ViolentRuby::UnixPasswordCracker.new(config) # not really doing anything | |
end |
This file contains hidden or 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
post '/crack_passwords' do | |
content_type :json | |
config = { | |
file: params['file'][:tempfile], | |
dictionary: params['dictionary'][:tempfile] | |
} | |
stream do |out| | |
ViolentRuby::UnixPasswordCracker.new(config).crack do |result| | |
out << result.to_json | |
end |
This file contains hidden or 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' | |
require 'thread' |
This file contains hidden or 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' | |
require 'thread' | |
# Class to signal end of operation for job queue. | |
class EndOfOp ; end |
This file contains hidden or 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
# previous code... | |
class PortScanner | |
def initialize(host:, ports: (1..1024)) | |
@host = host | |
@ports = ports | |
@semaphore = Mutex.new | |
end | |
This file contains hidden or 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
# previous code... | |
class PortScanner | |
# previous code ... | |
def connect_to(port, ip = @host) | |
# Create proccess to be ran later. | |
p = Proc.new do | |
# Create socket. |
This file contains hidden or 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
# previous code... | |
class PortScanner | |
# previous code ... | |
def threaded_scan(threads: 10) | |
pool = Queue.new | |
# Spool up jobs in a queue with its own thread. | |
Thread.new do |
This file contains hidden or 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
# previous code... | |
ps = PortScanner.new host: "target_ip_or_web.com" | |
ps.threaded_scan threads: 5 |
This file contains hidden or 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" | |
host = "target_ip" | |
ports = (1..1024).to_a | |
channel = Channel(Nil).new | |
semaphore = Mutex.new | |
spawn do | |
60.times do |
This file contains hidden or 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
ARGV << "example" | |
i = ARGV.index("example") | |
i # is 0 | |
result = i + 1 | |
# expect result to be 1 |