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
#include <libssh/libssh.h> | |
#include <libssh/server.h> | |
#include <libssh/callbacks.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
/* some def */ | |
int main () |
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
int authenticate(ssh_session session) { | |
ssh_message message; | |
do { | |
message=ssh_message_get(session); | |
if(!message) | |
break; | |
switch(ssh_message_type(message)){ | |
case SSH_REQUEST_AUTH: | |
switch(ssh_message_subtype(message)){ | |
case SSH_AUTH_METHOD_PASSWORD: |
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 'securerandom' | |
require 'thread' | |
require 'prime' | |
require 'openssl' | |
require 'socket' | |
require 'zlib' | |
require 'base64' | |
class IRC_RSA |
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 'benchmark/ips' | |
file = File.read("/home/unshadow/Desktop/text.txt") | |
data = file | |
Benchmark.ips do |bench| | |
bench.config(time: 5, warmup: 2) | |
bench.report("#gsub") do | |
unused = file.gsub(/Setting up/,'o') | |
file = data |
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 self.read_for_tcp_proxy(socket) | |
data = socket.read_nonblock(16_384) | |
while socket.pending > 0 | |
data += socket.read_nonblock(16_384) | |
end | |
data | |
rescue IO::WaitReadable |
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
module LibInject | |
extend FFI::Library | |
ffi_lib_flags :now, :global | |
ffi_lib 'libinjection.so' | |
class Sfilter < FFI::Struct | |
# layout :s, :pointer, | |
# :slen, :size_t, | |
# :userdata, :pointer, | |
# :flags, :int, | |
# :pos, :size_t |
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
# HTTP Reverse proxy server | |
# Original Source: http://rubyforge.org/snippet/download.php?type=snippet&id=162 | |
# Use case: you have several services running as different users | |
# for security purposes (they might even be chrooted). | |
# In production we use apache but for testing I prefer to use | |
# webrick because I find it more flexible for unit testing. | |
# The proxy mapping is modelled on the ProxyPass directive | |
# of apache. For example: | |
# |
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 self.rewrite_content_length(data) | |
new_size = data[:http_body].bytesize | |
if data[:http_headers].match(/Content-Length: (.*?)\r?\n/i) | |
data[:http_headers].gsub!(/Content-Length: (.*?)\r?\n/i, "Content-Length: #{new_size}\n") | |
else | |
data[:http_headers].strip! | |
data[:http_headers] << "\nContent-Length: #{new_size}\n\n" | |
end | |
data | |
end |
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
## Former code which works: | |
Thread.new(server.accept) do |client| | |
if client | |
addr = client.peeraddr if client | |
log.info("Client connected from IP: #{addr.ip_address} and port: #{addr.ip_port}") if log && addr | |
package_parser(client, log) | |
client.close if client | |
end | |
end |
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
# Maintainer: Jonne Haß <me@jhass.eu> | |
# Contributor: Mikkel Kroman <mk@maero.dk> | |
pkgname=crystal-git | |
pkgver=0.7.4.r0.g42efdbf | |
_last_release="0.7.4-1" | |
pkgrel=1 | |
pkgdesc="The Crystal Programming Language" | |
arch=('i686' 'x86_64') | |
url="http://crystal-lang.org" |