Login check.agi: Unterschied zwischen den Versionen
Aus metasec wiki
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) |
||
Zeile 5: | Zeile 5: | ||
<?php | <?php | ||
/* | /* | ||
− | * AGI Script for checking | + | * AGI Script for checking dialin permissions |
* (c) Lukas Ziaja <lz@metasec.de> | * (c) Lukas Ziaja <lz@metasec.de> | ||
*/ | */ | ||
Zeile 12: | Zeile 12: | ||
$in = fopen("php://stdin", "r" ); | $in = fopen("php://stdin", "r" ); | ||
/* | /* | ||
− | * clean up the | + | * clean up the given parameter strings |
*/ | */ | ||
foreach ( $argv as $key => $val ) | foreach ( $argv as $key => $val ) | ||
Zeile 72: | Zeile 72: | ||
<html> | <html> | ||
<head> | <head> | ||
− | <title> | + | <title>Adminmenu for dialin permissions</title> |
</head> | </head> | ||
Zeile 81: | Zeile 81: | ||
<td valign="top">Zugelassene Nummern</td> | <td valign="top">Zugelassene Nummern</td> | ||
<td><textarea cols="40" rows="15" name="nums"><?php | <td><textarea cols="40" rows="15" name="nums"><?php | ||
− | print(file_get_contents("nums.txt")); | + | if ( file_exists(file_get_contents("nums.txt") ) |
+ | print(file_get_contents("nums.txt")); | ||
Zeile 94: | Zeile 95: | ||
<td valign="top">Lastlog:</td> | <td valign="top">Lastlog:</td> | ||
<td style="font-family:Courier;"><?php | <td style="font-family:Courier;"><?php | ||
+ | |||
+ | if ( file_exists(file_get_contents("log.txt") ) { | ||
+ | |||
$F = file("log.txt"); | $F = file("log.txt"); | ||
$F = array_reverse($F); | $F = array_reverse($F); | ||
Zeile 103: | Zeile 107: | ||
break; | break; | ||
} | } | ||
+ | |||
+ | } | ||
?> | ?> |
Aktuelle Version vom 13. Oktober 2009, 20:11 Uhr
login_check.php
#!/usr/bin/php4 -q <?php /* * AGI Script for checking dialin permissions * (c) Lukas Ziaja <lz@metasec.de> */ $in = fopen("php://stdin", "r" ); /* * clean up the given parameter strings */ foreach ( $argv as $key => $val ) $argv[$key] = trim($val); if ( empty($argv[1]) ) { /* * just do some debug output */ echo "noop LEERE EINGABE!!!\n"; echo "set priority 100\n"; fclose($in); return true; } $f1 = fopen("/var/www/webtapi/log.txt", "a+"); fputs($f1, $argv[1]."\n"); fclose($f1); foreach ( file("/var/www/webtapi/nums.txt") as $line ) { $line = trim($line); if ( $line == $argv[1] ) { fclose($in); return 0; } } echo "hangup\n"; fclose($in); return 0; ?>
extensions.conf
exten => 123, 1, Agi(login_check.php,${CALLERID(num)}) exten => 123, 2, Answer exten => 123, 3, NoOp( Hier gehts weiter ) exten => 123, 4, Hangup
support_login.php
<?php if ( $_POST["nums"] ) { $f1 = fopen("/var/www/webtapi/nums.txt", "w+"); fputs($f1, str_replace("/", "",str_replace(" ", "",$_POST["nums"]))); fclose($f1); } ?> <html> <head> <title>Adminmenu for dialin permissions</title> </head> <body> <form name="" action="" method="post"> <table width="600" align="center" border="1"> <tr> <td valign="top">Zugelassene Nummern</td> <td><textarea cols="40" rows="15" name="nums"><?php if ( file_exists(file_get_contents("nums.txt") ) print(file_get_contents("nums.txt")); ?></textarea></td> </tr> <tr> <td></td> <td align="right"><input type="submit" value="Speichern"> </tr> <tr> <td valign="top">Lastlog:</td> <td style="font-family:Courier;"><?php if ( file_exists(file_get_contents("log.txt") ) { $F = file("log.txt"); $F = array_reverse($F); $i=0; foreach ( $F as $line ) { print(str_replace(" ", "\t", $line)."<br>\n"); if ( $i++ == 10 ) break; } } ?> </tr> </table> <form> </body> </html>