Skip to content

Instantly share code, notes, and snippets.

%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
-module(pdump).
-include("epcap_net.hrl").
-export([start/0, start/1]).
-export([filename/1]).
-record(state, {
s, % PF_PACKET socket
c % monitored connections
@msantos
msantos / dumpetag.erl
Created August 31, 2010 21:45
dumpetag: parse payloads using epcap
-module(dumpetag).
-include("epcap_net.hrl").
-export([start/0, start/1]).
-export([filename/1]).
-record(state, {
c % monitored connections
}).
@msantos
msantos / carp.erl
Created October 25, 2010 18:57
ARP poisoning
-module(carp).
-export([send/1, send/3]).
-define(ETHER_BROADCAST, <<16#FF, 16#FF, 16#FF, 16#FF, 16#FF, 16#FF>>).
-define(ETH_P_ARP, 16#0806).
-define(ETH_P_IP, 16#0800).
-define(ARPOP_REPLY, 2).
-define(ARPOP_REQUEST, 1).
@msantos
msantos / wsd.erl
Created November 15, 2010 01:53
Erlang API for websequencediagrams.com
-module(wsd).
-export([start/0, render/0, render/1]).
-export([body/1, request/1, fetch/1]).
-define(STYLE, "napkin").
-define(MESSAGE, "Alice->Bob: Authentication Request\n"
"note right of Bob: Bob thinks about it\n"
"Bob->Alice: Authentication Response\n").
@msantos
msantos / ptun.erl
Created December 4, 2010 01:41
ICMP Ping tunnel
-module(ptun).
-include("epcap_net.hrl").
-export([client/2, server/2]).
-define(TIMEOUT, 5000).
-define(PORT, 8787).
-record(state, {
addr,