~ubuntu-branches/ubuntu/raring/ettercap/raring-proposed

« back to all changes in this revision

Viewing changes to src/dissectors/ec_TN3270.c

  • Committer: Package Import Robot
  • Author(s): Barak A. Pearlmutter
  • Date: 2013-01-29 16:01:52 UTC
  • mfrom: (3.1.20 sid)
  • Revision ID: package-import@ubuntu.com-20130129160152-qbkch41k27dz5jwg
Tags: 1:0.7.5.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 
91
91
      ebcdic2ascii(ptr, PACKET->DATA.len, output);
92
92
 
93
 
      /* find username */
 
93
      /* scan packets to find username and password */
94
94
      for (i = 0; i < PACKET->DATA.len; i++) {
95
 
         // Logons start with 125 193 215 17 64 90 ordinals so we check for those
96
 
         if (ptr[i] == 125 && ptr[i+1] == 193 && ptr[i+2] == 215 && \
 
95
         /* find username, logons start with 125 193 (215 or 213) 17 64 90 ordinals
 
96
          * We relax the check for third byte because it is less error-prone that way */
 
97
         if (ptr[i] == 125 && ptr[i+1] == 193 && /* (ptr[i+2] == 215 || ptr[i+2] == 213) && */
97
98
                 ptr[i+3] == 17 && ptr[i+4] == 64 && ptr[i+5] == 90) {
98
99
                 /* scan for spaces */
99
100
                 int j = i + 6;
104
105
                 username[l-2] = 0;
105
106
                 DISSECT_MSG("%s:%d <= Username : %s\n", ip_addr_ntoa(&PACKET->L3.dst, tmp), ntohs(PACKET->L4.dst), username);
106
107
         }
 
108
         /* find password */
107
109
         if (ptr[i] == 125 && ptr[i+1] == 201 && ptr[i+3] == 17 && ptr[i+4] == 201 && ptr[i+5] == 195) {
108
110
                 strncpy(password, &output[i + 6], 512);
109
111
                 int l = strlen(password);