1. Tim Tomes
  2. Recon-ng

Commits

WebBreacher  committed 18e2583

removing excessive if resp statement

  • Participants
  • Parent commits 3512898
  • Branches master

Comments (0)

Files changed (6)

File modules/auxiliary/mcafee_affil.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Output the results in table format
-            tdata = [] 
-            tdata.append(['Domain/URL', 'Category', 'Links'])
-            for col in resp.json:
-                tdata.append([col['label'], col['hover'], str(col['link'])]) 
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
-        
+        # Output the results in table format
+        tdata = [] 
+        tdata.append(['Domain/URL', 'Category', 'Links'])
+        for col in resp.json:
+            tdata.append([col['label'], col['hover'], str(col['link'])]) 
+        self.table(tdata, True)

File modules/auxiliary/mcafee_dns.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Output the results in table format
-            tdata = [] 
-            tdata.append(['Domain', 'Hostname', 'IP', 'First Seen', 'Last Seen', 'Risk', 'Type'])
-            for col in resp.json['data']:
-                if col.has_key('IP'):       # Sometimes no IP is in the response
-                    ip = col['IP']
-                else:
-                    ip = 'No IP'
-                tdata.append([col['Domain'], col['Hostname'], ip, col['First_Seen'], col['Last_Seen'],col['Risk'], col['Type']])
-                
-                # Add each host to the database
-                if addhosts: self.add_host(col['Hostname'], address=ip)
-                
-            # Print the table  
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
-        
+        # Output the results in table format
+        tdata = [] 
+        tdata.append(['Domain', 'Hostname', 'IP', 'First Seen', 'Last Seen', 'Risk', 'Type'])
+        for col in resp.json['data']:
+            if col.has_key('IP'):       # Sometimes no IP is in the response
+                ip = col['IP']
+            else:
+                ip = 'No IP'
+            tdata.append([col['Domain'], col['Hostname'], ip, col['First_Seen'], col['Last_Seen'],col['Risk'], col['Type']])
+            
+            # Add each host to the database
+            if addhosts: self.add_host(col['Hostname'], address=ip)
+            
+        # Print the table  
+        self.table(tdata, True)

File modules/auxiliary/mcafee_mail.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Output the results in table format
-            tdata = [] 
-            tdata.append(['Domain', 'MX_Data', 'IP_Address', 'Weight'])
-            for col in resp.json['data']:
-                tdata.append([col['Domain'], col['MX_Data'], col['IP_Address'], col['Weight']])
-                
-                # Add each host to the database
-                if addhosts: self.add_host(col['MX_Data'], address=col['IP_Address'])
-                
-            # Print the table            
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
+        # Output the results in table format
+        tdata = [] 
+        tdata.append(['Domain', 'MX_Data', 'IP_Address', 'Weight'])
+        for col in resp.json['data']:
+            tdata.append([col['Domain'], col['MX_Data'], col['IP_Address'], col['Weight']])
+            
+            # Add each host to the database
+            if addhosts: self.add_host(col['MX_Data'], address=col['IP_Address'])
+            
+        # Print the table            
+        self.table(tdata, True)

File modules/auxiliary/mywot.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Get the security results
-            findings = re.findall(r'<application name="(\d)" r="(\d+)" c="(\d+)"', resp.text)
+        # Get the security results
+        findings = re.findall(r'<application name="(\d)" r="(\d+)" c="(\d+)"', resp.text)
+        
+        tdata = []
+        tdata.append(['Description', 'Reputation', 'Confidence'])
+        for line in findings:
+            # Description
+            if line[0] == '0':
+                descr = 'Trustworthiness'
+            elif line[0] == '1':
+                descr = 'Vendor Reliability'
+            elif line[0] == '2':
+                descr = 'Privacy'
+            elif line[0] == '4':
+                descr = 'Child Safety'
             
-            tdata = []
-            tdata.append(['Description', 'Reputation', 'Confidence'])
-            for line in findings:
-                # Description
-                if line[0] == '0':
-                    descr = 'Trustworthiness'
-                elif line[0] == '1':
-                    descr = 'Vendor Reliability'
-                elif line[0] == '2':
-                    descr = 'Privacy'
-                elif line[0] == '4':
-                    descr = 'Child Safety'
-                
-                # Reputation Scores
-                repTmp = int(line[1])
-                if repTmp >= 80:
-                    rep = 'Excellent'
-                elif 80 > repTmp >= 60:
-                    rep = 'Good'
-                elif 60 > repTmp >= 40:
-                    rep = 'Unsatisfactory'
-                elif 40 > repTmp >= 20:
-                    rep = 'Poor'
-                elif 20 > repTmp >= 0:
-                    rep = 'Very poor'
+            # Reputation Scores
+            repTmp = int(line[1])
+            if repTmp >= 80:
+                rep = 'Excellent'
+            elif 80 > repTmp >= 60:
+                rep = 'Good'
+            elif 60 > repTmp >= 40:
+                rep = 'Unsatisfactory'
+            elif 40 > repTmp >= 20:
+                rep = 'Poor'
+            elif 20 > repTmp >= 0:
+                rep = 'Very poor'
+            
+            # Confidence Scores
+            confTmp = int(line[2])
+            if confTmp >= 45:
+                conf = '5 - High'
+            elif 45 > confTmp >= 34:
+                conf = '4 - MedHigh'
+            elif 34 > confTmp >= 23:
+                conf = '3 - Medium'
+            elif 23 > confTmp >= 12:
+                conf = '2 - MedLow'
+            elif 12 > confTmp >= 6:
+                conf = '1 - Low'
+            else:
+                conf = '0 - None'
                 
-                # Confidence Scores
-                confTmp = int(line[2])
-                if confTmp >= 45:
-                    conf = '5 - High'
-                elif 45 > confTmp >= 34:
-                    conf = '4 - MedHigh'
-                elif 34 > confTmp >= 23:
-                    conf = '3 - Medium'
-                elif 23 > confTmp >= 12:
-                    conf = '2 - MedLow'
-                elif 12 > confTmp >= 6:
-                    conf = '1 - Low'
-                else:
-                    conf = '0 - None'
-                    
-                tdata.append([descr, rep, conf])
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
+            tdata.append([descr, rep, conf])
+        self.table(tdata, True)

File modules/auxiliary/siteadvisor_summary.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Get the overall security results
-            sec_results = re.findall(r'class="results">(.+)</p>', resp.text)
-            tdata_sec = [] 
-            tdata_sec.append(['Security Results'])
-            
-            # Get country of origin and number of users
-            finding_country = re.search(r'img src="/images/countryflags.+p> (.+)</td', resp.text)
-            finding_visitors = re.search(r'img src="/images/visitor.+p>(.+)</td', resp.text)
-            tdata_sec.append(['Country: ' + finding_country.group(1) + '                Visitors: ' + finding_visitors.group(1)])
-            tdata_sec.append([' '])
-            
-            # Line wrapping for long paragraph that breaks table formatting
-            paraMaxLen = 80
-            paraLen = len(sec_results[0])
-            if paraLen > paraMaxLen:
-                wrappedLines = []
-                for line in sec_results[0].split('\n'):
-                    while True:
-                        wrappedLines.append(line[:paraMaxLen])
-                        line = line[paraMaxLen:]
-                        if not line: break
-                for item in wrappedLines:
-                    tdata_sec.append([item])
-            self.table(tdata_sec, True)
+        # Get the overall security results
+        sec_results = re.findall(r'class="results">(.+)</p>', resp.text)
+        tdata_sec = [] 
+        tdata_sec.append(['Security Results'])
         
-            # Get the sites this domain's web site links to
-            finding = re.findall(r"area shape.+title='(.+)' onMouse", resp.text)
-            finding.sort()
-            tdata = [] 
-            tdata.append(['Domain(s) Linked to'])
-            for domain in finding:
-                tdata.append([domain])
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
+        # Get country of origin and number of users
+        finding_country = re.search(r'img src="/images/countryflags.+p> (.+)</td', resp.text)
+        finding_visitors = re.search(r'img src="/images/visitor.+p>(.+)</td', resp.text)
+        tdata_sec.append(['Country: ' + finding_country.group(1) + '                Visitors: ' + finding_visitors.group(1)])
+        tdata_sec.append([' '])
         
+        # Line wrapping for long paragraph that breaks table formatting
+        paraMaxLen = 80
+        paraLen = len(sec_results[0])
+        if paraLen > paraMaxLen:
+            wrappedLines = []
+            for line in sec_results[0].split('\n'):
+                while True:
+                    wrappedLines.append(line[:paraMaxLen])
+                    line = line[paraMaxLen:]
+                    if not line: break
+            for item in wrappedLines:
+                tdata_sec.append([item])
+        self.table(tdata_sec, True)
+    
+        # Get the sites this domain's web site links to
+        finding = re.findall(r"area shape.+title='(.+)' onMouse", resp.text)
+        finding.sort()
+        tdata = [] 
+        tdata.append(['Domain(s) Linked to'])
+        for domain in finding:
+            tdata.append([domain])
+        self.table(tdata, True)

File modules/auxiliary/urlvoid.py

View file
  • Ignore whitespace
             self.error(e.__str__())
             return
 
-        if resp:
-            # Get the security results
-            av_engines = re.findall(r'<td>(.+)</td>\n.*images/(.+)\.png" alt=""', resp.text)
-            tdata = []
-            tdata.append(['Site', 'Status'])
-            for line in av_engines:
-                tdata.append([line[0], line[1]])
-            self.table(tdata, True)
-
-        else:
-            self.output('No results found')
-        
+        # Get the security results
+        av_engines = re.findall(r'<td>(.+)</td>\n.*images/(.+)\.png" alt=""', resp.text)
+        tdata = []
+        tdata.append(['Site', 'Status'])
+        for line in av_engines:
+            tdata.append([line[0], line[1]])
+        self.table(tdata, True)