Nmap Development mailing list archives

[PATCH] Use (is|to)(lower|upper) functions in skid_output()


From: Kris Katterjohn <kjak () ispwest com>
Date: Sat, 11 Mar 2006 14:52:52 -0600

The attached patch uses the function islower(), isupper(), tolower(), and
toupper() instead the current way in skid_output() in output.cc.

Thanks,
Kris
--- output.cc.orig      2006-03-05 18:00:03.000000000 -0600
+++ output.cc   2006-03-11 14:43:15.000000000 -0600
@@ -149,10 +149,12 @@ static void skid_output(char *s)
        case 'z': s[i]='s'; break;
        case 'Z': s[i]='S'; break;
        }  
-    else
+    else if ((rand() % 3) == 0)
       {
-       if (s[i]>='A' && s[i]<='Z' && (rand()%3==0)) s[i]+='a'-'A';
-       else if (s[i]>='a' && s[i]<='z' && (rand()%3==0)) s[i]-='a'-'A';
+       if (isupper(s[i]))
+          s[i] = tolower(s[i]);
+       else if (islower(s[i]))
+          s[i] = toupper(s[i]);
       }
 }
 


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

Current thread: