Changeset 1408
- Timestamp:
- 10/08/07 20:41:00 (11 months ago)
- Files:
-
- honeytrap/trunk/src/modules/htm_ftpDownload.c (modified) (3 diffs)
- honeytrap/trunk/src/modules/htm_tftpDownload.c (modified) (2 diffs)
- honeytrap/trunk/src/util.c (modified) (1 diff)
- honeytrap/trunk/src/util.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeytrap/trunk/src/modules/htm_ftpDownload.c
r1387 r1408 160 160 } 161 161 logmsg(LOG_DEBUG, 1, "FTP download - %s resolves to %s.\n", token.string, 162 inet_ntoa(*(struct in_addr*)host->h_addr _list[0]));163 164 if (!replace_private_ips && !valid_ipaddr( (uint32_t) *(host->h_addr_list[0]))) {162 inet_ntoa(*(struct in_addr*)host->h_addr)); 163 164 if (!replace_private_ips && !valid_ipaddr(*(struct in_addr*)host->h_addr)) { 165 165 logmsg(LOG_INFO, 1, "FTP download error - %s is not a valid ip address.\n", 166 166 inet_ntoa(*(struct in_addr*)host->h_addr_list[0])); … … 337 337 338 338 /* replace private ip? */ 339 if (replace_private_ips && (private_ipaddr( rhost->s_addr) || !(valid_ipaddr(rhost->s_addr)))) {339 if (replace_private_ips && (private_ipaddr(*rhost) || !(valid_ipaddr(*rhost)))) { 340 340 logmsg(LOG_NOISY, 1, "FTP download - Replacing private/invalid server address with attacking IP address.\n"); 341 341 rhost = (struct in_addr *) &attack->a_conn.r_addr; … … 500 500 inet_ntoa(*(struct in_addr*)data_host->h_addr_list[0])); 501 501 502 if (!valid_ipaddr( (uint32_t) *(data_host->h_addr_list[0]))) {502 if (!valid_ipaddr(*(struct in_addr*)data_host->h_addr)) { 503 503 logmsg(LOG_INFO, 1, "FTP download error - %s is not a valid ip address.\n", 504 504 inet_ntoa(*(struct in_addr*)data_host->h_addr_list[0])); honeytrap/trunk/src/modules/htm_tftpDownload.c
r1356 r1408 113 113 inet_ntoa(*(struct in_addr*)host->h_addr_list[0])); 114 114 115 if (!replace_private_ips && !valid_ipaddr( (uint32_t) *(host->h_addr_list[0]))) {115 if (!replace_private_ips && !valid_ipaddr(*(struct in_addr*)host->h_addr)) { 116 116 logmsg(LOG_INFO, 1, "TFTP download error - %s is not a valid ip address.\n", 117 117 inet_ntoa(*(struct in_addr*)host->h_addr_list[0])); … … 174 174 175 175 /* replace private ip? */ 176 if (replace_private_ips && (private_ipaddr( host->s_addr) || !(valid_ipaddr(host->s_addr)))) {176 if (replace_private_ips && (private_ipaddr(*host) || !(valid_ipaddr(*host)))) { 177 177 logmsg(LOG_NOISY, 1, "TFTP download - Replacing private/invalid server address with attacking IP address.\n"); 178 178 host = (struct in_addr *) &attack->a_conn.r_addr; honeytrap/trunk/src/util.c
r1355 r1408 29 29 30 30 /* check if 'address' is an ip address with a reasonable value */ 31 int valid_ipaddr(uint32_t address) { 32 return(address > 0xffffff ? 1 : 0); 31 int valid_ipaddr(struct in_addr address) { 32 u_char octet[4]; 33 34 octet[0] = address.s_addr; 35 octet[1] = address.s_addr >> 8; 36 octet[2] = address.s_addr >> 16; 37 octet[3] = address.s_addr >> 24; 38 39 if (!octet[0] || !octet[3]) return(0); 40 if (address.s_addr == 0xffffffff) return(0); 41 42 return(1); 33 43 } 34 44 35 45 36 46 /* test if 'address' is a rfc1918 ip address */ 37 int private_ipaddr( uint32_taddress) {47 int private_ipaddr(struct in_addr address) { 38 48 int i; 39 49 40 50 for (i=0; i<(sizeof(priv_prefixes)/4); i++) 41 if ((ntohl(address ) & priv_prefixes[i]) == ntohl(address)) return(1);51 if ((ntohl(address.s_addr) & priv_prefixes[i]) == ntohl(address.s_addr)) return(1); 42 52 43 53 return(0); honeytrap/trunk/src/util.h
r1334 r1408 30 30 31 31 32 int valid_ipaddr( uint32_taddress);33 int private_ipaddr( uint32_taddress);32 int valid_ipaddr(struct in_addr address); 33 int private_ipaddr(struct in_addr address); 34 34 int read_line(int socket, char *line, ssize_t len, int timeout); 35 35 struct strtk extract_token(char *parse_string);
