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 'hexdump' | |
BUFFER_SIZE = 1024 | |
loop do | |
data = socket.recv(BUFFER_SIZE) | |
Hexdump.dump(data) | |
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
# Receive every packet | |
ETH_P_ALL = 0x0300 | |
# Size in bytes of a C `sockaddr_ll` structure on a 64-bit system | |
# | |
# struct sockaddr_ll { | |
# unsigned short sll_family; /* Always AF_PACKET */ | |
# unsigned short sll_protocol; /* Physical-layer protocol */ | |
# int sll_ifindex; /* Interface number */ | |
# unsigned short sll_hatype; /* ARP hardware type */ |
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' | |
# Size in bytes of a C `ifreq` structure on a 64-bit system | |
# http://man7.org/linux/man-pages/man7/netdevice.7.html | |
# | |
# struct ifreq { | |
# char ifr_name[IFNAMSIZ]; /* Interface name */ | |
# union { | |
# struct sockaddr ifr_addr; | |
# struct sockaddr ifr_dstaddr; |
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
socket = Socket.new(:INET, :DGRAM) |
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' | |
BUFFER_SIZE = 1024 | |
socket = UDPSocket.new | |
socket.bind('192.168.33.10', 4321) | |
loop do | |
message, sender = socket.recvfrom(BUFFER_SIZE) |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type Video struct { | |
Name string | |
} |
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
class Calc | |
NUMBERS = %w[one two three four five six seven eight nine ten] | |
def initialize(number = 0, meth = nil) | |
@number = number | |
@meth = meth | |
end | |
NUMBERS.each_with_index do |number, index| | |
define_method(number) 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
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/ | |
/usr/sbin/pkg_add -r curl | |
/usr/sbin/pkg_add -r wget |
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 'io/console' | |
Signal.trap(:SIGINT) { exit } | |
puts "CTRL-C to quit...\n" | |
print 'Password: ' | |
password = STDIN.noecho(&:gets) | |
puts |
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
<?php | |
require_once("functions.inc"); | |
require_once("config.lib.inc"); | |
require_once("auth.inc"); | |
if ($_POST) { | |
$a_user = &$config['system']['user']; | |
unset($input_errors); | |
$pconfig = $_POST; |