Port Scanner with PHP

by maxtor - 23-06-2015, 11:27 AM
Closed Account
Posts:
26
Joined:
Jun 2015
Likes:
0
Credits:
29
Reputation:
0
2 Years of Service
#1
OP
Posted: 23-06-2015, 11:27 AM
[Image: P5yPDQ.png]


Code:
<Form method = "post">
   Domaine / IP:
   <Input type = "text" name = "domaine" />
   <Input type = "submit" value = "Scan" />
</ Form>
<br />

<? Php
if (! empty ($ _ POST ['domain'])) {    
   // Liste des numéros de port pour numériser
   $ = Ports Array (21, 22, 23, 25, 53, 80, 110, 1433, 3306);
   
   Résultats $ = array ();
   foreach ($ ports que le port) {$
       if ($ pF = fsockop de ($ _ POST ['domain'], $ port, $ err, err_string $, 1)) {
           $ Résultats [$ port] = true;
           fclose ($ PF);
       } Else {
           $ Résultats [$ port] = false;
       }
   }

   foreach ($ résultats que $ port => $ val) {
       $ Protéines = getservbyport ($ port, "tcp");
               echo "$ Port Port ($ protéine):";
       if ($ val) {
           echo "<span style = \" color: \ green "> Trouvé </ span> <br/>";
       }
       else {
           echo "
<span style = \" color: \ red "> Introuvable </ span> <br/>";
       }
   }
}
?>

<Html> <body> <h1> Codé de Sepultura - 1923Turk © </ body> </ html>
Novice
Posts:
48
Joined:
Jun 2015
Likes:
2
Credits:
23
Reputation:
0
2 Years of Service
#2
Posted: 25-06-2015, 10:38 PM
Cool. That code needs to be cleaned up to be usable though. This may also not work on all hosts or servers
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)