Montag, 10. Oktober 2005
In Ein Heim für Server hatte ich ja bereits auf die Türsteuerung per SNMP verwiesen.
Hier ist mal ein kleiner Hack, wie sich sowas in PHP realisieren lässt.
<?php// IP der CMC-TC mit angeschlossener Access Unit$cmc = ' 127. 0. 0. 1'; // WriteCommunity Name$community = ' private'; // Anschluss der Access Unit an CMC-TC PUII (1-4)$unit = ' 1'; function doorstatus ($door) { switch ($door) { case 4: $status= "okay"; break; case 5: $status= "alarm"; break; case 11: $status= "open"; break; case 12: $status= "closed"; break; case 13: $status= "locked"; break; case 14: $status= "unlocked by remote input"; break; case 15: $status= "unlocked by reader or keypad"; break; case 16: $status= "unlocked by SNMP set command"; break; case 17: $status= "unlocked by WEB"; break; case 18: $status= "unlocked by timer"; break; default: {FNAMEL}">die("snmp query received unknown return value."); } return $status; }if ($_GET['action' ] == 'unlock' ) { if ($_GET['door' ] == 1) { $return = snmpset ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 6. 2. 1. 6. 2', "i", "4"); } elseif ($_GET['door' ] == 2) { $return = snmpset ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 6. 2. 1. 6. 5', "i", "4"); } {FNAMEL}">header("Location: $_SERVER[PHP_SELF]"); } elseif ($_GET['action' ] == 'lock' ) { if ($_GET['door' ] == 1) { $return = snmpset ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 6. 2. 1. 6. 2', "i", "3"); } elseif ($_GET['door' ] == 2) { $return = snmpset ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 6. 2. 1. 6. 5', "i", "3"); } {FNAMEL}">header("Location: $_SERVER[PHP_SELF]"); }$door1 = {FNAMEL}">substr(snmpget ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 7. 2. 1. 3. 1' ), 9); $door1_last = {FNAMEL}">substr(snmpget ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 7. 2. 1. 3. 2' ), 9); $door2 = {FNAMEL}">substr(snmpget ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 7. 2. 1. 3. 3' ), 9); $door2_last = {FNAMEL}">substr(snmpget ($cmc, $community,'. 1. 3. 6. 1. 4. 1. 2606. 4. 2.'. ($unit + 2).'. 7. 2. 1. 3. 4' ), 9); {FNAMEL}">echo "<html><head><title>Türsteuerung per SNMP</title></head><body>"; {FNAMEL}">echo 'Frontdoor is currently '.doorstatus ($door1).' <form><input type= "hidden" name= "action" value= "unlock"><input type= "hidden" name= "door" value= "1"><input type= "submit" value= "Unlock"></form> Frontdoor was last '.doorstatus ($door1_last).'<br /> Reardoor is currently '.doorstatus ($door2).' <form><input type= "hidden" name= "action" value= "unlock"><input type= "hidden" name= "door" value= "2"><input type= "submit" value= "Unlock"></form> Reardoor was last '.doorstatus ($door2_last); {FNAMEL}">echo "<body></html>"?>
|
[Note to english speaking readers, aggregating this blog: The following article is written in german about gaining root on a piece of embedded server monitor hardware from Rittal and configuring ssh access. If there is demand, I'll translate this article
Aufgenommen: Jun 29, 14:21
[Note to english speaking readers, aggregating this blog: The following article is written in german about gaining root on a piece of embedded server monitor hardware from Rittal and configuring ssh access. If there is demand, I'll translate this article
Aufgenommen: Jun 29, 15:13