php Archive
Discovery hosts and services with PHP and Nmap
Requirements:
- PHP5
- PEAR::Net_Nmap
- nmap
<?php
/**
* Scan network to retrieve hosts and services information.
*/
require_once 'Net/Nmap.php';
//Define the target to scan
$target = array('127.0.0.1','www.yourserver.com');
$options = array('nmap_binary' => '/usr/local/bin/nmap');
try {
$nmap = new Net_Nmap($options);
//Enable nmap options
$nmap_options = array('os_detection' => true,
[...]
Execute SQL script from a file using PHP
The code below allows to retrieve and execute all SQL statements defined in a SQL script file removing all comments.
<?php
$sql_file = 'test.sql';
$contents = file_get_contents($sql_file);
// Remove C style and inline comments
$comment_patterns = array('/\/\*.*(\n)*.*(\*\/)?/', //C comments
[...]
Find It Quickly
Find what you're looking for quickly by using our keyword search. Can't find it? Try our links below.


