1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

sed -i 's/if ( /if (/g' *.cc *.h; sed -i 's/for ( /for (/g' *.cc *.h; sed -i 's/( /(/g' nmap_amigaos.h tcpip.h service_scan.cc

There's still quite a lot of code like this, nse_openssl.cc being most
messy IMHO. Also, I left out "if( something )" syntax.
This commit is contained in:
d33tah
2014-06-25 15:40:54 +00:00
parent 3e6e5b1c51
commit a80c90608c
14 changed files with 31 additions and 31 deletions

View File

@@ -1848,7 +1848,7 @@ int FPHost6::build_probe_list() {
i++; i++;
/* Set untimed TCP probes */ /* Set untimed TCP probes */
for ( ; i < NUM_FP_PROBES_IPv6_TCP; i++) { for (; i < NUM_FP_PROBES_IPv6_TCP; i++) {
/* If the probe is targeted to a TCP port and we don't have /* If the probe is targeted to a TCP port and we don't have
* any port number for that particular state, skip the probe. */ * any port number for that particular state, skip the probe. */
if (TCP_DESCS[i].dstport == OPEN && this->open_port_tcp < 0) if (TCP_DESCS[i].dstport == OPEN && this->open_port_tcp < 0)

View File

@@ -535,7 +535,7 @@ static void make_ipv6_netmask(struct in6_addr *mask, int bits) {
i = 0; i = 0;
/* 0 < bits <= 128, so this loop goes at most 15 times. */ /* 0 < bits <= 128, so this loop goes at most 15 times. */
for ( ; bits > 8; bits -= 8) for (; bits > 8; bits -= 8)
mask->s6_addr[i++] = 0xFF; mask->s6_addr[i++] = 0xFF;
mask->s6_addr[i] = 0xFF << (8 - bits); mask->s6_addr[i] = 0xFF << (8 - bits);
} }

View File

@@ -219,7 +219,7 @@ int ipv6_get_fragment_id(const struct ip6_hdr *ip6, unsigned int len) {
p += (*(p + 1) + 1) * 8; p += (*(p + 1) + 1) * 8;
} }
if ( hdr != IP_PROTO_FRAGMENT || (p + 2 + sizeof(ip6_ext_data_fragment)) > end) if (hdr != IP_PROTO_FRAGMENT || (p + 2 + sizeof(ip6_ext_data_fragment)) > end)
return -1; return -1;
frag_header = (struct ip6_ext_data_fragment *)( p + 2 ); frag_header = (struct ip6_ext_data_fragment *)( p + 2 );
@@ -1081,7 +1081,7 @@ static int idlescan_countopen2(struct idle_proxy_info *proxy,
but doing it the straightforward way (using the same decoys as but doing it the straightforward way (using the same decoys as
we use in probing the proxy box is risky. I'll have to think we use in probing the proxy box is risky. I'll have to think
about this more. */ about this more. */
if ( o.af() == AF_INET ) { if (o.af() == AF_INET ) {
send_tcp_raw(proxy->rawsd, eth.ethsd ? &eth : NULL, send_tcp_raw(proxy->rawsd, eth.ethsd ? &eth : NULL,
proxy->host.v4hostip(), target->v4hostip(), proxy->host.v4hostip(), target->v4hostip(),
o.ttl, false, o.ttl, false,

View File

@@ -142,8 +142,8 @@ struct Library *SocketBase = NULL, *MiamiBase = NULL, *MiamiBPFBase = NULL, *Mia
static const char ver[] = "$VER:" NMAP_NAME " v"NMAP_VERSION " [Amiga.sf]"; static const char ver[] = "$VER:" NMAP_NAME " v"NMAP_VERSION " [Amiga.sf]";
static void CloseLibs(void) { static void CloseLibs(void) {
if ( MiamiPCapBase ) CloseLibrary( MiamiPCapBase ); if (MiamiPCapBase ) CloseLibrary( MiamiPCapBase );
if ( MiamiBPFBase ) CloseLibrary( MiamiBPFBase ); if (MiamiBPFBase ) CloseLibrary( MiamiBPFBase );
if ( SocketBase ) CloseLibrary( SocketBase ); if ( SocketBase ) CloseLibrary( SocketBase );
if ( MiamiBase ) CloseLibrary( MiamiBase ); if ( MiamiBase ) CloseLibrary( MiamiBase );
} }

View File

@@ -948,7 +948,7 @@ void parse_options(int argc, char **argv) {
fatal("--top-ports should be an integer 1 or greater"); fatal("--top-ports should be an integer 1 or greater");
} else if (optcmp(long_options[option_index].name, "ip-options") == 0) { } else if (optcmp(long_options[option_index].name, "ip-options") == 0) {
o.ipoptions = (u8*) safe_malloc(4 * 10 + 1); o.ipoptions = (u8*) safe_malloc(4 * 10 + 1);
if ( (o.ipoptionslen = parse_ip_options(optarg, o.ipoptions, 4 * 10 + 1, &o.ipopt_firsthop, &o.ipopt_lasthop, errstr, sizeof(errstr))) == OP_FAILURE) if ((o.ipoptionslen = parse_ip_options(optarg, o.ipoptions, 4 * 10 + 1, &o.ipopt_firsthop, &o.ipopt_lasthop, errstr, sizeof(errstr))) == OP_FAILURE)
fatal("%s", errstr); fatal("%s", errstr);
if (o.ipoptionslen > 4 * 10) if (o.ipoptionslen > 4 * 10)
fatal("Ip options can't be more than 40 bytes long"); fatal("Ip options can't be more than 40 bytes long");

View File

@@ -142,14 +142,14 @@
//Pcap functions replacement using miamipcap.library (MiamiSDK v2.11) //Pcap functions replacement using miamipcap.library (MiamiSDK v2.11)
#define pcap_open_live(a, b, c, d...) MiamiPCapOpenLive(a, b, 0, d) #define pcap_open_live(a, b, c, d...) MiamiPCapOpenLive(a, b, 0, d)
#define pcap_filter(args...) MiamiPCapFilter( args) #define pcap_filter(args...) MiamiPCapFilter(args)
#define pcap_close(args...) MiamiPCapClose( args) #define pcap_close(args...) MiamiPCapClose(args)
#define pcap_datalink(args...) MiamiPCapDatalink( args) #define pcap_datalink(args...) MiamiPCapDatalink(args)
#define pcap_geterr(args...) MiamiPCapGeterr( args) #define pcap_geterr(args...) MiamiPCapGeterr(args)
#define pcap_next(args...) MiamiPCapNext( args) #define pcap_next(args...) MiamiPCapNext(args)
#define pcap_lookupnet(args...) MiamiPCapLookupnet( args) #define pcap_lookupnet(args...) MiamiPCapLookupnet(args)
#define pcap_compile(args...) MiamiPCapCompile( args) #define pcap_compile(args...) MiamiPCapCompile(args)
#define pcap_setfilter(args...) MiamiPCapSetfilter( args) #define pcap_setfilter(args...) MiamiPCapSetfilter(args)
#ifndef DLT_MIAMI #ifndef DLT_MIAMI
#define DLT_MIAMI 100 #define DLT_MIAMI 100

View File

@@ -131,7 +131,7 @@
extern NmapOps o; extern NmapOps o;
struct ftpinfo get_default_ftpinfo(void) { struct ftpinfo get_default_ftpinfo(void) {
#if (defined(IN_ADDR_DEEPSTRUCT) || defined( SOLARIS)) #if (defined(IN_ADDR_DEEPSTRUCT) || defined(SOLARIS))
/* Note that struct in_addr in solaris is 3 levels deep just to store an /* Note that struct in_addr in solaris is 3 levels deep just to store an
* unsigned int! */ * unsigned int! */
struct ftpinfo ftp = { FTPUSER, FTPPASS, "", { { { 0 } } } , 21, 0}; struct ftpinfo ftp = { FTPUSER, FTPPASS, "", { { { 0 } } } , 21, 0};

View File

@@ -459,7 +459,7 @@ static int l_DES_string_to_key(lua_State *L) /** DES_string_to_key( string data
{ {
size_t len; size_t len;
const unsigned char *data = (unsigned char *) luaL_checklstring( L, 1, &len ); const unsigned char *data = (unsigned char *) luaL_checklstring( L, 1, &len );
if ( len != 7 ) if (len != 7 )
return luaL_error( L, "String must have length of 7 bytes." ); return luaL_error( L, "String must have length of 7 bytes." );
DES_cblock key; DES_cblock key;

View File

@@ -2449,7 +2449,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
seq_AVs.push_back(AV); seq_AVs.push_back(AV);
/* SS: Shared IP ID sequence boolean */ /* SS: Shared IP ID sequence boolean */
if ( (tcp_ipid_seqclass == IPID_SEQ_INCR || if ((tcp_ipid_seqclass == IPID_SEQ_INCR ||
tcp_ipid_seqclass == IPID_SEQ_BROKEN_INCR || tcp_ipid_seqclass == IPID_SEQ_BROKEN_INCR ||
tcp_ipid_seqclass == IPID_SEQ_RPI) && tcp_ipid_seqclass == IPID_SEQ_RPI) &&
(icmp_ipid_seqclass == IPID_SEQ_INCR || (icmp_ipid_seqclass == IPID_SEQ_INCR ||
@@ -2459,7 +2459,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
are in the same sequence. */ are in the same sequence. */
AV.attribute = "SS"; AV.attribute = "SS";
u32 avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1); u32 avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1);
if ( hss->ipid.icmp_ipids[0] < hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] + 3 * avg) { if (hss->ipid.icmp_ipids[0] < hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] + 3 * avg) {
AV.value = "S"; AV.value = "S";
} else { } else {
AV.value = "O"; AV.value = "O";

View File

@@ -2335,7 +2335,7 @@ static void printtraceroute_normal(Target *currenths) {
/* The beginning and end of timeout consolidation. */ /* The beginning and end of timeout consolidation. */
int begin_ttl, end_ttl; int begin_ttl, end_ttl;
begin_ttl = end_ttl = it->ttl; begin_ttl = end_ttl = it->ttl;
for ( ; it != currenths->traceroute_hops.end() && it->timedout; it++) for (; it != currenths->traceroute_hops.end() && it->timedout; it++)
end_ttl = it->ttl; end_ttl = it->ttl;
if (begin_ttl == end_ttl) if (begin_ttl == end_ttl)
Tbl.addItem(row, RTT_COL, false, "..."); Tbl.addItem(row, RTT_COL, false, "...");

View File

@@ -1928,7 +1928,7 @@ int UltraScanInfo::removeCompletedHosts() {
/* We don't want to run this all of the time */ /* We don't want to run this all of the time */
TIMEVAL_MSEC_ADD(compare, lastCompletedHostRemoval, completedHostLifetime / 2); TIMEVAL_MSEC_ADD(compare, lastCompletedHostRemoval, completedHostLifetime / 2);
if ( TIMEVAL_AFTER(now, compare) ) { if (TIMEVAL_AFTER(now, compare) ) {
for (hostI = completedHosts.begin(); hostI != completedHosts.end(); hostI = nxt) { for (hostI = completedHosts.begin(); hostI != completedHosts.end(); hostI = nxt) {
nxt = hostI; nxt = hostI;
nxt++; nxt++;
@@ -1939,7 +1939,7 @@ int UltraScanInfo::removeCompletedHosts() {
continue; continue;
TIMEVAL_MSEC_ADD(compare, hss->completiontime, completedHostLifetime); TIMEVAL_MSEC_ADD(compare, hss->completiontime, completedHostLifetime);
if ( TIMEVAL_AFTER(now, compare) ) { if (TIMEVAL_AFTER(now, compare) ) {
completedHosts.erase(hostI); completedHosts.erase(hostI);
hostsRemoved++; hostsRemoved++;
} }

View File

@@ -1650,7 +1650,7 @@ void ServiceNFO::addToServiceFingerprint(const char *probeName, const u8 *resp,
// Now for the probe response itself ... // Now for the probe response itself ...
for(srcidx=0; srcidx < respused; srcidx++) { for(srcidx=0; srcidx < respused; srcidx++) {
// A run of this can take up to 8 chars: "\n \x20" // A run of this can take up to 8 chars: "\n \x20"
assert( servicefpalloc - servicefplen > 8); assert(servicefpalloc - servicefplen > 8);
if (isalnum((int)resp[srcidx])) if (isalnum((int)resp[srcidx]))
addServiceChar((char) resp[srcidx], servicewrap); addServiceChar((char) resp[srcidx], servicewrap);
@@ -2262,7 +2262,7 @@ static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *m
#if HAVE_OPENSSL #if HAVE_OPENSSL
// Snag our SSL_SESSION from the nsi for use in subsequent connections. // Snag our SSL_SESSION from the nsi for use in subsequent connections.
if (nsi_checkssl(nsi)) { if (nsi_checkssl(nsi)) {
if ( svc->ssl_session ) { if (svc->ssl_session ) {
if (svc->ssl_session == (SSL_SESSION *)(nsi_get0_ssl_session(nsi))) { if (svc->ssl_session == (SSL_SESSION *)(nsi_get0_ssl_session(nsi))) {
//nada //nada
} else { } else {

View File

@@ -356,7 +356,7 @@ u8 *build_tcp_raw_ipv6(const struct in6_addr *source,
/* Build and send a raw tcp packet. If TTL is -1, a partially random /* Build and send a raw tcp packet. If TTL is -1, a partially random
(but likely large enough) one is chosen */ (but likely large enough) one is chosen */
int send_tcp_raw( int sd, const struct eth_nfo *eth, int send_tcp_raw(int sd, const struct eth_nfo *eth,
const struct in_addr *source, const struct in_addr *victim, const struct in_addr *source, const struct in_addr *victim,
int ttl, bool df, int ttl, bool df,
u8* ipopt, int ipoptlen, u8* ipopt, int ipoptlen,
@@ -365,7 +365,7 @@ int send_tcp_raw( int sd, const struct eth_nfo *eth,
u8 *options, int optlen, u8 *options, int optlen,
const char *data, u16 datalen); const char *data, u16 datalen);
int send_tcp_raw_decoys( int sd, const struct eth_nfo *eth, int send_tcp_raw_decoys(int sd, const struct eth_nfo *eth,
const struct in_addr *victim, const struct in_addr *victim,
int ttl, bool df, int ttl, bool df,
u8* ipopt, int ipoptlen, u8* ipopt, int ipoptlen,
@@ -392,14 +392,14 @@ u8 *build_udp_raw_ipv6(const struct in6_addr *source,
u8 hoplimit, u16 sport, u16 dport, u8 hoplimit, u16 sport, u16 dport,
const char *data, u16 datalen, u32 *packetlen); const char *data, u16 datalen, u32 *packetlen);
int send_udp_raw( int sd, const struct eth_nfo *eth, int send_udp_raw(int sd, const struct eth_nfo *eth,
struct in_addr *source, const struct in_addr *victim, struct in_addr *source, const struct in_addr *victim,
int ttl, u16 ipid, int ttl, u16 ipid,
u8* ipopt, int ipoptlen, u8* ipopt, int ipoptlen,
u16 sport, u16 dport, u16 sport, u16 dport,
const char *data, u16 datalen); const char *data, u16 datalen);
int send_udp_raw_decoys( int sd, const struct eth_nfo *eth, int send_udp_raw_decoys(int sd, const struct eth_nfo *eth,
const struct in_addr *victim, const struct in_addr *victim,
int ttl, u16 ipid, int ttl, u16 ipid,
u8* ipops, int ip, u8* ipops, int ip,

View File

@@ -1081,7 +1081,7 @@ static Hop *merge_hops(const struct sockaddr_storage *tag, Hop *a, Hop *b) {
p->parent = a; p->parent = a;
else if (b != NULL) else if (b != NULL)
p->parent = b; p->parent = b;
for ( ; p != NULL; p = p->parent) for (; p != NULL; p = p->parent)
p->tag = *tag; p->tag = *tag;
return head.parent; return head.parent;