/*************************************************************************** * nipper - The network infrastructure parser * * Copyright (C) 2006 - 2007 by Ian Ventura-Whiting (Fizz) * * fizz@titania.co.uk * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************/ // Defines... #define false 0 #define true 1 #define unconfigured 2 #define output_text 0 #define output_html 1 #define output_latex 2 // 3 is reserved! #define output_xml 4 #define type_ios_router 0 // Cisco IOS Router #define type_ios_switch 1 // Cisco IOS Switch #define type_ios_catalyst 2 // Cisco IOS Catalyst #define type_pix_firewall 3 // Cisco PIX Firewall #define type_asa_firewall 4 // Cisco ASA Firewall #define type_fwsm_firewall 5 // Cisco FWSM Firewall #define type_sos_firewall 6 // Juniper ScreenOS Firewall #define type_nmp_catalyst 7 // Cisco NMP Catalyst #define type_cos_catalyst 8 // Cisco CatOS Catalyst #define type_css_filter 9 // Cisco Content Services Switch (CSS) #define auth_none 0 #define auth_clear 1 #define auth_md5 2 #define encrypt_type7 0 #define encrypt_md5 1 #define encrypt_des56 2 #define encrypt_none 3 #define encrypt_unknown 4 #define encrypt_pix 5 #define encrypt_mschap 6 #define encrypt_ntenc 7 #define perm_permit 0 #define perm_deny 1 #define perm_op_none 0 #define perm_op_lt 1 #define perm_op_gt 2 #define perm_op_eq 3 #define perm_op_neq 4 #define perm_op_range 5 // Structs... struct host // Host { char server[32]; struct host *next; }; struct netInterface // Interfaces { char interface[32]; struct netInterface *next; }; #define vtp_mode_server 0 #define vtp_mode_client 1 #define vtp_mode_transparent 2 #define vtp_mode_none 3 struct ciscoIOSConfig // Cisco IOS configuration { // Configuration settings... int sourceRouting; // true or false int tcpSmallServers; // true, false, unconfigured int udpSmallServers; // true, false, unconfigured int finger; // true, false, unconfigured int cdp; // true or false int cef; // true or false int bootp; // true or false int servicePasswordEncryption; // true or false int bootNetwork; // true or false int serviceConfig; // true or false int pad; // true or false int domainLookup; // true or false int classlessRouting; // true or false int keepAlivesIn; // true or false int keepAlivesOut; // true or false int gratuitousArps; // true or false int calendarValid; // true (default) or false char summerTimeZone[8]; // Empty is disabled char timeZone[8]; // default (UTC) int timeOffsetHours; int timeOffsetMins; int passwordMinLength; // 6 is default on IOS 12.3(1)+, otherwise it doesn't exist int vtpMode; // vtp_mode_server (default)... char vtpDomain[34]; // VTP Domain struct host *dns; // DNS Servers struct ntpConfig *ntp; // NTP struct enablePassword *enable; // Enable Passwords struct accessList *access; // Access Lists struct snmpConfig *snmp; // SNMP struct ftpConfig *ftp; // FTP struct usernameList *username; // Users struct privilageLevels *privilage; // Privilege Levels struct loggingConfig *logging; // Logging struct tacacsConfig *tacacs; // TACACS struct aaaConfig *aaa; // AAA struct httpConfig *http; // HTTP struct sshConfig *ssh; // SSH struct interfaceConfig *interface; // Interfaces struct routeMapConfig *routeMap; // Routing - Route Maps struct staticRoute *route; // Routing - Static struct ripConfig *rip; // Routing - RIP struct ospfConfig *ospf; // Routing - OSPF struct eigrpConfig *eigrp; // Routing - EIGRP struct isisConfig *isis; // Routing - ISIS struct bgpConfig *bgp; // Routing - BGP struct keyChain *chain; // Key Chain struct lineConfig *line; // Local / Remote Administration Lines struct bannerConfig *banner; // Logon Banner struct natConfig *nat; // NAT }; struct ciscoPIXConfig // Cisco PIX configuration { // Counters int oldAccessList; int standardAccessList; int extendedAccessList; int interfaceAccessList; // Configuration settings... char password[32]; int transparent; // Transparent Firewall (true or false) struct enablePIXPassword *enable; // Enable Passwords struct interfacePIXConfig *interface; // Interfaces struct accessListPIX *access; // Access Lists int accessListAlertInterval; int accessListDenyFlowMax; struct sshPIXConfig *ssh; // SSH Configuration struct objectGroupList *objectGroup; // Object Groups struct namePIXList *nameList; // Name mappings struct usernamePIX *username; // Users struct fixupList *fixup; // Protocol Analysis struct icmpAccess *icmp; // ICMP to interfaces struct staticPIX *staticNAT; // Static NAT / PAT struct routePIX *route; // Static Routes }; struct ciscoCSSConfig // Cisco CSS Configuration { // Services int snmpAccess; // true (default) or false int ftpAccess; // true (default) or false int telnetAccess; // true (default) or false int sshAccess; // true (default) or false int consoleAccess; // true (default) or false int webManagementAccess; // true or false (default) // Device Settings int aclEnabled; // unconfigured (default), true or false (set to true with first ACL) // Configuration structures struct snmpCSS *snmp; struct cssAcl *acl; }; struct ciscoNMPConfig // Cisco NMP Configuration { // Configuration settings... char location[64]; char contact[64]; int timeout; char coreFile[32]; char syslogFile[32]; char password[32]; char enablePassword[32]; int cdp; int cdpInterval; int cdpHoldtime; int cdpVersion; int portSecurityAuto; struct switchNMPConfig *switchConfig; struct snmpNMP *snmp; struct moduleConfig *module; struct permitConfig *permit; struct vlanConfig *vlan; }; struct hostNMP // NMP Host Struct { char host[32]; char netMask[16]; struct hostNMP *next; }; struct screenOSConfig // Juniper ScreenOS Configuration { struct adminSOS *admin; // Admin settings struct authServerSOS *authServer; // Authentication settings struct interfaceSOS *interface; // Interfaces struct policySOS *policies; // Zone Policy Settings struct addressSOS *nameList; // Address name mappings // SSH Settings int sshVersion; // SSH Server Protocol Version int sshEnabled; // SSH Server Enabled/Disabled true or false int sshKeyGenTime; // Mins for Key Gen - SSH V1 Only char sshPublicKey[128]; // Public Key - SSH v2 Only // Program options... struct johnPassword *john; }; struct listSOS // NetScreenOS List { char name[32]; struct listSOS *next; }; #define use_all 0 #define use_edge 1 #define use_internal 2 struct nipperConfig // Global Configuration { // Program options... char companyName[128]; struct johnPassword *john; // Latex options char paperSize[32]; char documentClass[32]; // SNMP Options char remoteIP[16]; // Retrival of Config remotely - IP char localIP[16]; // Retrival of Config remotely - IP (local) char remoteTftp[128]; // Retrival of Config remotely - TFTP root char remoteSnmp[128]; // Retrival of Config remotely - SNMP community int localSave; // Retrival of Config remotely - Config Save Name int oldCisco; // Retrival of Config remotely - Old or new methods // Report Output Options int outputFormat; // Output file format output_text... int abs; // Abbreviation output int loggingLevels; // Logging Levels output int timeZones; // Time Zone output int appendix; // Appendix output int glossary; // Glossary output int commonPorts; // Common Ports output int fullReport; // Output full reports int expandACL; // Expand an ACL's object definitions. int names; // Show hostnames instead of IP addresses (where possible) int passwords; // Output passwords? int nipperVersion; // Output nipper appendix version details // Filtering options int denyLog; // Check for deny all and log at the end of filtering rules int strictACL; // Check for source filtering // Debug Options int debugMode; // Show debug output int linesnotprocessed; // Print the lines that were not processed (true or false) int debugAbbrev; // Output Abbreviations that were not found // File Handles / File Names char outputFile[128]; // Argument that contains output file, if specified. char johnFile[128]; // John the ripper file name FILE *input; // Input file FILE *reportFile; // Report file FILE *dictionaryFile; // Dictionary file FILE *cssFile; // HTML CSS file // Default Password Settings int passwordLength; int passwordUppers; int passwordLowers; int passwordEither; int passwordNumbers; int passwordSpecials; // Connection settings int connectionTimeout; // The Connection Timeout // Counters... int simplePasswords; int passwordStrengths; int insecureTimeouts; int vulnIssues; int vulnIssueDos; int vulnIssueRemote; // Misc Variables... int maxSize; int tableNum; // Device Details... int deviceType; // type_screenos... int deviceUse; // use_edge, use_internal, use_all (default) char hostname[128]; char domainName[128]; char friendlyHostname[148]; char version[10]; int versionMajor; int versionMinor; int versionRevision; // Device Specific Configuration struct ciscoIOSConfig *ios; struct ciscoPIXConfig *pix; struct ciscoNMPConfig *nmp; struct ciscoCSSConfig *css; struct screenOSConfig *sos; }; // Used to break each line up struct ciscoCommand { int parts; char part[40][128]; }; // Encrypted passwords for john struct johnPassword { char username[128]; char password[128]; struct johnPassword *next; }; // SNMP Traps struct snmpTrap { char trap[128]; int enabled; struct snmpTrap *next; }; #define object_type_network 0 #define object_type_protocol 1 #define object_type_icmp 2 #define object_type_service 3 #define object_type_group 4 #define object_type_port 5 #define object_type_host 6 #define object_service_none 0 #define object_service_tcp 1 #define object_service_udp 2 #define object_service_both 3 struct objectGroupList { int type; // object_type_network... int serviceType; // object_service_tcp... char name[64]; char description[64]; struct objectList *object; struct objectGroupList *next; }; struct objectList { char object[64]; char netMask[16]; int type; struct objectList *next; };