Home page logo
/

nmap-dev logo Nmap Development mailing list archives

RFE: make more functions and variables static
From: "Dmitry V. Levin" <ldv () altlinux org>
Date: Sat, 4 Mar 2006 02:47:44 +0300

Hi,

While updating my drop-priv patch for nmap-4.01, I noticed that nmap *.o
files define a lot of global symbols, obviously more than necessary.

I wrote a simple script (for GNU/Linux) to find potential symbols which
could be made static:

===
for f in *.o; do
        nm -g "$f" |awk -vf="$f" 'NF==3 && $2~/^[BDT]$/ {printf("%s\t%s\n",$3,f)}'
done |sort >def

for f in *.o; do
        nm -g "$f" |awk -vf="$f" 'NF==2 && $1=="U" {printf("%s\t%s\n",$2,f)}'
done |sort >ref

comm -23 \
    <(cut -f1 def |sort -u) \
    <(join def ref |awk '$2!=$3 {print $1}' |sort -u) |
        c++filt |fgrep -v :: |grep -vw main
===

(The "main" symbol is false alarm, c++ methods are not interesting at this
stage of analisys.)

On my patched nmap-4.01 sources this script outputs ~100 symbols,
your output may differ slightly:

===
MacTable
AVal_match(AVal*, AVal*, unsigned long*, unsigned long*, int)
WriteSInfo(char*, int, int, int, unsigned char const*)
printusage(char*, int)
gcd_n_ulong(long, unsigned long*)
processData(UltraScanInfo*)
skid_output(char*)
NmapArpCache(int, sockaddr_storage*, unsigned char*)
end_svcprobe(void*, serviceprobestate, ServiceGroup*, ServiceNFO*, void*)
findMACEntry(int)
readippacket(unsigned char const*, int)
send_udp_raw(int, eth_nfo*, in_addr*, in_addr const*, int, unsigned short, unsigned short, unsigned short, char*, 
unsigned short)
sport_decode(UltraScanInfo*, unsigned short, unsigned int*, unsigned int*)
getattrbyname(AVal*, char const*)
gettestbyname(FingerTest*, char const*)
hostInExclude(sockaddr*, unsigned int, TargetGroup*)
hoststructfry(Target**, int)
idle_treescan(idle_proxy_info*, Target*, unsigned short*, int, int)
ipid_distance(int, unsigned short, unsigned short)
printAnyStats(UltraScanInfo*)
readhoststate(int)
readudppacket(unsigned char const*, int)
sendPingProbe(UltraScanInfo*, HostScanStats*)
sendpingquery(int, int, eth_handle*, Target*, unsigned short, unsigned short, scanstats*, timeval*, int, pingtech)
add_dns_server(char*)
ip_is_reserved(in_addr*)
output_summary()
parse_etchosts(char*)
process_result(unsigned int, char*, int, unsigned short)
get_fingerprint(Target*, seq_info*)
ippackethdrinfo(unsigned char const*, unsigned int)
lookup_etchosts(unsigned int)
parse_classline(FingerTest*, char*, int, int*)
rpc_are_we_done(char*, int, Target*, portinfo*, scanstats*, portinfolist*, rpcscaninfo*)
sendpingqueries(int, int, eth_handle*, Target*, unsigned short, unsigned short, scanstats*, timeval*, int, pingtech)
allow_ipid_match(unsigned short, unsigned short)
check_capacities(dns_server_s*)
getInterfaceByIP(sockaddr_storage*)
get_ping_results(int, pcap*, Target**, int, timeval*, pingtune*, timeout_info*, int, pingtech*, scan_lists*)
ipid_proxy_probe(idle_proxy_info*, int*, int*)
read_evt_handler(void*, void*, void*)
close_dns_servers()
match_fingerprint(FingerTest*, FingerPrintResults*, FingerTest**, double)
parse_inaddr_arpa(unsigned char*, int)
write_evt_handler(void*, void*, void*)
adjust_idle_timing(idle_proxy_info*, Target*, int, int)
do_possible_writes()
getInterfaceByName(char*)
idlescan_countopen(idle_proxy_info*, Target*, unsigned short*, int, timeval*, timeval*)
print_MAC_XML_Info(Target*)
collect_dnet_routes(route_entry const*, void*)
connect_dns_servers()
connect_evt_handler(void*, void*, void*)
grab_next_host_spec(_IO_FILE*, int, char**)
idlescan_countopen2(idle_proxy_info*, Target*, unsigned short*, int, timeval*, timeval*)
nmap_mass_rdns_core(Target**, int)
parse_resolvdotconf()
send_frag_ip_packet(int, eth_nfo*, unsigned char*, unsigned int, unsigned int)
sendconnecttcpquery(Target**, tcpqueryinfo*, Target*, int, unsigned short, timeval*, pingtune*, timeout_info*, int)
sendrawtcppingquery(int, eth_nfo*, Target*, int, unsigned short, unsigned short, timeval*, pingtune*)
sendrawudppingquery(int, eth_nfo*, Target*, unsigned short, unsigned short, timeval*, pingtune*)
compare_fingerprints(FingerTest*, FingerTest*, int)
initialize_idleproxy(idle_proxy_info*, char*, in_addr const*)
send_closedudp_probe(int, eth_nfo*, in_addr const*, unsigned short, unsigned short)
advance_past_dns_name(unsigned char*, int, int, int*)
remove_excluded_ports(AllProbes*, ServiceGroup*)
reverse_testing_order(portinfolist*, portinfo*)
sendconnecttcpqueries(Target**, tcpqueryinfo*, Target*, unsigned short, timeval*, pingtune*, timeout_info*, int)
encoded_name_to_normal(unsigned char*, char*, int)
parse_fingerprint_file(char*)
put_dns_packet_on_wire(request_s*)
ultrascan_adjust_times(UltraScanInfo*, HostScanStats*, UltraProbe*, timeval*)
collect_dnet_interfaces(intf_entry const*, void*)
fileexistsandisreadable(char*)
fingerprint_iptcppacket(ip*, int, unsigned int)
fingerprint_portunreach(ip*, udpprobeinfo*)
launchSomeServiceProbes(void*, ServiceGroup*)
deal_with_timedout_reads()
parse_single_fingerprint(char*)
sendrawtcpudppingqueries(int, eth_handle*, Target*, int, unsigned short, timeval*, pingtune*)
servicescan_read_handler(void*, void*, void*)
shouldWePrintFingerprint(ServiceNFO*)
add_integer_to_dns_packet(char*, int)
servicescan_write_handler(void*, void*, void*)
get_connecttcpscan_results(tcpqueryinfo*, Target**, timeval*, pingtune*, timeout_info*)
servicescan_connect_handler(void*, void*, void*)
ultrascan_port_pspec_update(UltraScanInfo*, HostScanStats*, probespec const*, int)
output_rangelist_given_ports(int, unsigned short*, int)
parse_nmap_service_probe_file(AllProbes*, char*)
Write(int, void const*, unsigned int)
doArp(char const*, unsigned char const*, sockaddr_storage const*, sockaddr_storage const*, unsigned char*)
Sendto(char*, int, unsigned char const*, int, unsigned int, sockaddr*, int)
gcd_uint(unsigned int, unsigned int)
massping(Target**, int, scan_lists*, int)
str2AVal(char*)
tty_done()
gcd_ulong(unsigned long, unsigned long)
read_timeouts
===


-- 
ldv


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]