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
#!/usr/bin/env escript | |
% This escript sends malformed SSLv3 client_hello to specified server | |
% and prints negotiated version and cipher suite | |
% | |
% Usage example: ./badhello.escript localhost 9998 | |
-module(badhello). | |
-include_lib("ssl/src/ssl_handshake.hrl"). | |
client_hello() -> |
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
#!/usr/bin/env escript | |
%% -*- mode: erlang -*- | |
%% vim: sw=2 ts=2 | |
% This escript sends garbage SSLv3 record between client_hello and any other record | |
% to specified server causing acceptor to crash with function_clause | |
% | |
% Usage example: ./badhandshake.escript localhost 9998 | |
-module(badhandshake). | |
-include_lib("ssl/src/ssl_handshake.hrl"). |
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
#!/usr/bin/env escript | |
%% -*- mode: erlang -*- | |
%% vim: sw=2 ts=2 | |
% This escript sends valid TLSv1.2 client_hello to specified server | |
% crashing the OTP 17.0 acceptor due to bad hashsign default value | |
% | |
% Usage example: ./tlsv12_no_hs.escript localhost 9998 | |
-module(tlsv12_no_hs). | |
-include_lib("ssl/src/ssl_handshake.hrl"). |
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
ebin/*.beam |
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(leb128). | |
-export([encode/2, decode/2]). | |
encode(Value, signed) -> | |
encode_ranged(Value, 0, 16#40); | |
encode(Value, unsigned) when Value >= 0 -> | |
encode_ranged(Value, 0, 16#80). |
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(gs_up). | |
-export([init/1, handle_call/3, terminate/2]). | |
-record(state, { | |
own_fields, | |
field1, | |
field2, | |
field3 | |
}). |
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(bubble). | |
-export([sort/1, sort/2]). | |
sort(List) -> | |
sort(fun erlang:'=<'/2, List, []). | |
sort(Compare, List) -> | |
sort(Compare, List, []). | |
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(cue_parse). | |
-export([parse_md/1]). | |
parse_md(<<CatNumber:128/binary, LeadInNum:64/integer, IsCD:1, 0:2071, TrackNum:8, Rest/binary>>) -> | |
Metadate = #{cat_number => CatNumber, lead_in => LeadInNum, is_cd => (IsCD == 1), tracks => TrackNum}, | |
{ok, Metadate, Rest}; | |
parse_md(<<_/binary>>) -> | |
{error, not_enough_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
#!/usr/bin/env escript | |
%% -*- mode: erlang -*- | |
%%! -pa ranch/ebin -sname ranch_race +P 1000000 +A 200 +K true -env ERL_MAX_PORTS 1000000 | |
%% This script is tested only in Linux environment. | |
%% I could not make it work with Mac OS (it limits connection rate). | |
%% | |
%% Warning: you are likely going to hit max open files limit. | |
%% Before running this script you should raise max fds by executing: | |
%% sudo -E -- bash -c "ulimit -n 1000000; sudo -E -u $USER bash --login" |
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(bininspector). | |
% For inspecting binary usage by all accessible ETS tables, run | |
% [{T, (catch ets:foldl(fun bininspector:collect/2, {0, 0}, T))} || T <- ets:all()]. | |
-export([collect/2]). | |
collect(B, {S, R}) when is_bitstring(B) -> | |
{S + byte_size(B), R + binary:referenced_byte_size(B)}; | |
collect(T, Acc) when is_tuple(T) -> |
OlderNewer