Skip to content

Instantly share code, notes, and snippets.

@joshtwo
Created July 14, 2014 14:56
Show Gist options
  • Save joshtwo/9aaf25bb5287c7f283d8 to your computer and use it in GitHub Desktop.
Save joshtwo/9aaf25bb5287c7f283d8 to your computer and use it in GitHub Desktop.
Lets you send raw packets to dAmn one by one.
<?php
function connect_to_dA()
{
$s = fsockopen('tcp://199.15.160.100', 3900);
stream_set_blocking($s, 0);
return $s;
}
function input_loop($socket, $prompt='> ')
{
$stdin = fopen('php://stdin', 'r');
$input = '';
$response = '';
while (($input = fgets($stdin)) != null)
{
$input = str_replace("\\\\n", "\0n", $input);
$input = str_replace("\\n", "\n", $input);
$input = str_replace("\0n", "\n", $input);
$input .= "\0";
if(!fputs($socket, $input))
{
echo "Something done fucked majorly. Press enter to continue.\n";
fgets($input);
return;
}
while ($response[count($response)-1] != "\0")
$response = fread($response, 8192);
echo str_replace("\0", "EOP\n\n", $response);
}
}
function main()
{
echo "Connecting to dA...\n";
$s = connect_to_dA();
if (!$s)
{
die("Oh brilliant, so we can't connect to dA.\n");
}
echo "You're going to have to type raw packets to communicate on dAmn without the assistance of the Botdom wiki. Godspeed.\n";
input_loop($s);
}
main();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment