Skip to content

Commit

Permalink
sed -i 's/if ( /if (/g' *.cc *.h; sed -i 's/for ( /for (/g' *.cc *.h;…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
d33tah committed Jun 25, 2014
1 parent 3e6e5b1 commit a80c906
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion FPEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ int FPHost6::build_probe_list() {
i++;

/* 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
* any port number for that particular state, skip the probe. */
if (TCP_DESCS[i].dstport == OPEN && this->open_port_tcp < 0)
Expand Down
2 changes: 1 addition & 1 deletion TargetGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ static void make_ipv6_netmask(struct in6_addr *mask, int bits) {

i = 0;
/* 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 << (8 - bits);
}
Expand Down
4 changes: 2 additions & 2 deletions idle_scan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int ipv6_get_fragment_id(const struct ip6_hdr *ip6, unsigned int len) {
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;

frag_header = (struct ip6_ext_data_fragment *)( p + 2 );
Expand Down Expand Up @@ -1081,7 +1081,7 @@ static int idlescan_countopen2(struct idle_proxy_info *proxy,
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
about this more. */
if ( o.af() == AF_INET ) {
if (o.af() == AF_INET ) {
send_tcp_raw(proxy->rawsd, eth.ethsd ? &eth : NULL,
proxy->host.v4hostip(), target->v4hostip(),
o.ttl, false,
Expand Down
8 changes: 4 additions & 4 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ struct Library *SocketBase = NULL, *MiamiBase = NULL, *MiamiBPFBase = NULL, *Mia
static const char ver[] = "$VER:" NMAP_NAME " v"NMAP_VERSION " [Amiga.sf]";

static void CloseLibs(void) {
if ( MiamiPCapBase ) CloseLibrary( MiamiPCapBase );
if ( MiamiBPFBase ) CloseLibrary( MiamiBPFBase );
if ( SocketBase ) CloseLibrary( SocketBase );
if ( MiamiBase ) CloseLibrary( MiamiBase );
if (MiamiPCapBase ) CloseLibrary( MiamiPCapBase );
if (MiamiBPFBase ) CloseLibrary( MiamiBPFBase );
if ( SocketBase ) CloseLibrary( SocketBase );
if ( MiamiBase ) CloseLibrary( MiamiBase );
}

static BOOL OpenLibs(void) {
Expand Down
2 changes: 1 addition & 1 deletion nmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ void parse_options(int argc, char **argv) {
fatal("--top-ports should be an integer 1 or greater");
} else if (optcmp(long_options[option_index].name, "ip-options") == 0) {
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);
if (o.ipoptionslen > 4 * 10)
fatal("Ip options can't be more than 40 bytes long");
Expand Down
16 changes: 8 additions & 8 deletions nmap_amigaos.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@

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

#ifndef DLT_MIAMI
#define DLT_MIAMI 100
Expand Down
2 changes: 1 addition & 1 deletion nmap_ftp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
extern NmapOps o;

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
* unsigned int! */
struct ftpinfo ftp = { FTPUSER, FTPPASS, "", { { { 0 } } } , 21, 0};
Expand Down
2 changes: 1 addition & 1 deletion nse_openssl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static int l_DES_string_to_key(lua_State *L) /** DES_string_to_key( string data
{
size_t 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." );

DES_cblock key;
Expand Down
4 changes: 2 additions & 2 deletions osscan2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2449,7 +2449,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
seq_AVs.push_back(AV);

/* 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_RPI) &&
(icmp_ipid_seqclass == IPID_SEQ_INCR ||
Expand All @@ -2459,7 +2459,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
are in the same sequence. */
AV.attribute = "SS";
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";
} else {
AV.value = "O";
Expand Down
2 changes: 1 addition & 1 deletion output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2335,7 +2335,7 @@ static void printtraceroute_normal(Target *currenths) {
/* The beginning and end of timeout consolidation. */
int begin_ttl, end_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;
if (begin_ttl == end_ttl)
Tbl.addItem(row, RTT_COL, false, "...");
Expand Down
4 changes: 2 additions & 2 deletions scan_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ int UltraScanInfo::removeCompletedHosts() {

/* We don't want to run this all of the time */
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) {
nxt = hostI;
nxt++;
Expand All @@ -1939,7 +1939,7 @@ int UltraScanInfo::removeCompletedHosts() {
continue;

TIMEVAL_MSEC_ADD(compare, hss->completiontime, completedHostLifetime);
if ( TIMEVAL_AFTER(now, compare) ) {
if (TIMEVAL_AFTER(now, compare) ) {
completedHosts.erase(hostI);
hostsRemoved++;
}
Expand Down
4 changes: 2 additions & 2 deletions service_scan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ void ServiceNFO::addToServiceFingerprint(const char *probeName, const u8 *resp,
// Now for the probe response itself ...
for(srcidx=0; srcidx < respused; srcidx++) {
// 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]))
addServiceChar((char) resp[srcidx], servicewrap);
Expand Down Expand Up @@ -2262,7 +2262,7 @@ static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *m
#if HAVE_OPENSSL
// Snag our SSL_SESSION from the nsi for use in subsequent connections.
if (nsi_checkssl(nsi)) {
if ( svc->ssl_session ) {
if (svc->ssl_session ) {
if (svc->ssl_session == (SSL_SESSION *)(nsi_get0_ssl_session(nsi))) {
//nada
} else {
Expand Down
8 changes: 4 additions & 4 deletions tcpip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
(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,
int ttl, bool df,
u8* ipopt, int ipoptlen,
Expand All @@ -365,7 +365,7 @@ int send_tcp_raw( int sd, const struct eth_nfo *eth,
u8 *options, int optlen,
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,
int ttl, bool df,
u8* ipopt, int ipoptlen,
Expand All @@ -392,14 +392,14 @@ u8 *build_udp_raw_ipv6(const struct in6_addr *source,
u8 hoplimit, u16 sport, u16 dport,
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,
int ttl, u16 ipid,
u8* ipopt, int ipoptlen,
u16 sport, u16 dport,
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,
int ttl, u16 ipid,
u8* ipops, int ip,
Expand Down
2 changes: 1 addition & 1 deletion traceroute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ static Hop *merge_hops(const struct sockaddr_storage *tag, Hop *a, Hop *b) {
p->parent = a;
else if (b != NULL)
p->parent = b;
for ( ; p != NULL; p = p->parent)
for (; p != NULL; p = p->parent)
p->tag = *tag;

return head.parent;
Expand Down

0 comments on commit a80c906

Please sign in to comment.