Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Bug fixes for Python 3, updated Dockerfile.

smicallef6897f5e5e3be
diff --git a/Dockerfile b/Dockerfile
index 629c9047..e71447df 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,19 +18,19 @@ FROM alpine:latest
COPY requirements.txt .
# Run everything as one command so that only one layer is created
-RUN apk --update add --no-cache --virtual build-dependencies gcc git curl py2-pip swig \
- tinyxml-dev python2-dev musl-dev openssl-dev libffi-dev libxslt-dev \
- && apk --update --no-cache add python2 musl openssl libxslt tinyxml \
- && pip --no-cache-dir install wheel \
- && pip --no-cache-dir install -r requirements.txt \
+RUN apk --update add --no-cache --virtual build-dependencies gcc git curl py3-pip swig \
+ tinyxml-dev python3-dev musl-dev openssl-dev libffi-dev libxslt-dev \
+ && apk --update --no-cache add python3 musl openssl libxslt tinyxml jpeg-dev openjpeg-dev zlib-dev \
+ && pip3 --no-cache-dir install wheel \
+ && pip3 --no-cache-dir install -r requirements.txt \
&& addgroup spiderfoot \
&& adduser -G spiderfoot -h /home/spiderfoot -s /sbin/nologin \
-g "SpiderFoot User" -D spiderfoot \
&& rmdir /home/spiderfoot \
&& cd /home \
- && curl -sSL https://github.com/smicallef/spiderfoot/archive/master.tar.gz \
+ && curl -sSL https://github.com/smicallef/spiderfoot/archive/py3.tar.gz \
| tar -v -C /home -xz \
- && mv /home/spiderfoot-master /home/spiderfoot \
+ && mv /home/spiderfoot-py3 /home/spiderfoot \
&& chown -R spiderfoot:spiderfoot /home/spiderfoot \
&& apk del --purge build-dependencies \
&& rm -rf /var/cache/apk/* \
@@ -42,5 +42,5 @@ WORKDIR /home/spiderfoot
EXPOSE 5001
# Run the application.
-ENTRYPOINT ["/usr/bin/python"]
+ENTRYPOINT ["/usr/bin/python3"]
CMD ["./sf.py", "0.0.0.0:5001"]
diff --git a/lib/socks.py b/lib/socks.py
deleted file mode 100644
index 5b31dd0a..00000000
--- a/lib/socks.py
+++ /dev/null
@@ -1,400 +0,0 @@
-"""SocksiPy - Python SOCKS module.
-Version 1.00
-
-Copyright 2006 Dan-Haim. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of Dan Haim nor the names of his contributors may be used
- to endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE.
-
-
-This module provides a standard socket-like interface for Python
-for tunneling connections through SOCKS proxies.
-
-"""
-
-"""
-
-Minor modifications made by Christopher Gilbert (http://motomastyle.com/)
-for use in PyLoris (http://pyloris.sourceforge.net/)
-
-Minor modifications made by Mario Vilas (http://breakingcode.wordpress.com/)
-mainly to merge bug fixes found in Sourceforge
-
-Minor modification made by Steve Micallef (http://www.binarypool.com/)
-to add getaddrinfo, as per http://stackoverflow.com/questions/13184205/dns-over-proxy
-
-"""
-
-import socket
-import struct
-import sys
-
-PROXY_TYPE_SOCKS4 = 1
-PROXY_TYPE_SOCKS5 = 2
-PROXY_TYPE_HTTP = 3
-
-_defaultproxy = None
-_orgsocket = socket.socket
-
-class ProxyError(Exception): pass
-class GeneralProxyError(ProxyError): pass
-class Socks5AuthError(ProxyError): pass
-class Socks5Error(ProxyError): pass
-class Socks4Error(ProxyError): pass
-class HTTPError(ProxyError): pass
-
-_generalerrors = ("success",
- "invalid data",
- "not connected",
- "not available",
- "bad proxy type",
- "bad input")
-
-_socks5errors = ("succeeded",
- "general SOCKS server failure",
- "connection not allowed by ruleset",
- "Network unreachable",
- "Host unreachable",
- "Connection refused",
- "TTL expired",
- "Command not supported",
- "Address type not supported",
- "Unknown error")
-
-_socks5autherrors = ("succeeded",
- "authentication is required",
- "all offered authentication methods were rejected",
- "unknown username or invalid password",
- "unknown error")
-
-_socks4errors = ("request granted",
- "request rejected or failed",
- "request rejected because SOCKS server cannot connect to identd on the client",
- "request rejected because the client program and identd report different user-ids",
- "unknown error")
-
-def setdefaultproxy(proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):
- """setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
- Sets a default proxy which all further socksocket objects will use,
- unless explicitly changed.
- """
- global _defaultproxy
- _defaultproxy = (proxytype, addr, port, rdns, username, password)
-
-def create_connection(address, timeout=None, source_address=None):
- sock = socksocket()
- sock.connect(address)
- return sock
-
-def getaddrinfo(*args):
- return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
-
-def wrapmodule(module):
- """wrapmodule(module)
- Attempts to replace a module's socket library with a SOCKS socket. Must set
- a default proxy using setdefaultproxy(...) first.
- This will only work on modules that import socket directly into the namespace;
- most of the Python Standard Library falls into this category.
- """
- if _defaultproxy != None:
- module.socket.socket = socksocket
- else:
- raise GeneralProxyError((4, "no proxy specified"))
-
-class socksocket(socket.socket):
- """socksocket([family[, type[, proto]]]) -> socket object
- Open a SOCKS enabled socket. The parameters are the same as
- those of the standard socket init. In order for SOCKS to work,
- you must specify family=AF_INET, type=SOCK_STREAM and proto=0.
- """
-
- def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None):
- _orgsocket.__init__(self, family, type, proto, _sock)
- if _defaultproxy != None:
- self.__proxy = _defaultproxy
- else:
- self.__proxy = (None, None, None, None, None, None)
- self.__proxysockname = None
- self.__proxypeername = None
-
- def __recvall(self, count):
- """__recvall(count) -> data
- Receive EXACTLY the number of bytes requested from the socket.
- Blocks until the required number of bytes have been received.
- """
- data = self.recv(count)
- while len(data) < count:
- d = self.recv(count-len(data))
- if not d: raise GeneralProxyError((0, "connection closed unexpectedly"))
- data = data + d
- return data
-
- def setproxy(self, proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):
- """setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
- Sets the proxy to be used.
- proxytype - The type of the proxy to be used. Three types
- are supported: PROXY_TYPE_SOCKS4 (including socks4a),
- PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP
- addr - The address of the server (IP or DNS).
- port - The port of the server. Defaults to 1080 for SOCKS
- servers and 8080 for HTTP proxy servers.
- rdns - Should DNS queries be preformed on the remote side
- (rather than the local side). The default is True.
- Note: This has no effect with SOCKS4 servers.
- username - Username to authenticate with to the server.
- The default is no authentication.
- password - Password to authenticate with to the server.
- Only relevant when username is also provided.
- """
- self.__proxy = (proxytype, addr, port, rdns, username, password)
-
- def __negotiatesocks5(self, destaddr, destport):
- """__negotiatesocks5(self,destaddr,destport)
- Negotiates a connection through a SOCKS5 server.
- """
- # First we'll send the authentication packages we support.
- if (self.__proxy[4]!=None) and (self.__proxy[5]!=None):
- # The username/password details were supplied to the
- # setproxy method so we support the USERNAME/PASSWORD
- # authentication (in addition to the standard none).
- self.sendall(struct.pack('BBBB', 0x05, 0x02, 0x00, 0x02))
- else:
- # No username/password were entered, therefore we
- # only support connections with no authentication.
- self.sendall(struct.pack('BBB', 0x05, 0x01, 0x00))
- # We'll receive the server's response to determine which
- # method was selected
- chosenauth = self.__recvall(2)
- if chosenauth[0:1] != chr(0x05).encode():
- self.close()
- raise GeneralProxyError((1, _generalerrors[1]))
- # Check the chosen authentication method
- if chosenauth[1:2] == chr(0x00).encode():
- # No authentication is required
- pass
- elif chosenauth[1:2] == chr(0x02).encode():
- # Okay, we need to perform a basic username/password
- # authentication.
- self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])
- authstat = self.__recvall(2)
- if authstat[0:1] != chr(0x01).encode():
- # Bad response
- self.close()
- raise GeneralProxyError((1, _generalerrors[1]))
- if authstat[1:2] != chr(0x00).encode():
- # Authentication failed
- self.close()
- raise Socks5AuthError((3, _socks5autherrors[3]))
- # Authentication succeeded
- else:
- # Reaching here is always bad
- self.close()
- if chosenauth[1] == chr(0xFF).encode():
- raise Socks5AuthError((2, _socks5autherrors[2]))
- else:
- raise GeneralProxyError((1, _generalerrors[1]))
- # Now we can request the actual connection
- req = struct.pack('BBB', 0x05, 0x01, 0x00)
- # If the given destination address is an IP address, we'll
- # use the IPv4 address request even if remote resolving was specified.
- try:
- ipaddr = socket.inet_aton(destaddr)
- req = req + chr(0x01).encode() + ipaddr
- except socket.error:
- # Well it's not an IP number, so it's probably a DNS name.
- if self.__proxy[3]:
- # Resolve remotely
- ipaddr = None
- req = req + chr(0x03).encode() + chr(len(destaddr)).encode() + destaddr
- else:
- # Resolve locally
- ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
- req = req + chr(0x01).encode() + ipaddr
- req = req + struct.pack(">H", destport)
- self.sendall(req)
- # Get the response
- resp = self.__recvall(4)
- if resp[0:1] != chr(0x05).encode():
- self.close()
- raise GeneralProxyError((1, _generalerrors[1]))
- elif resp[1:2] != chr(0x00).encode():
- # Connection failed
- self.close()
- if ord(resp[1:2])<=8:
- raise Socks5Error((ord(resp[1:2]), _socks5errors[ord(resp[1:2])]))
- else:
- raise Socks5Error((9, _socks5errors[9]))
- # Get the bound address/port
- elif resp[3:4] == chr(0x01).encode():
- boundaddr = self.__recvall(4)
- elif resp[3:4] == chr(0x03).encode():
- resp = resp + self.recv(1)
- boundaddr = self.__recvall(ord(resp[4:5]))
- else:
- self.close()
- raise GeneralProxyError((1,_generalerrors[1]))
- boundport = struct.unpack(">H", self.__recvall(2))[0]
- self.__proxysockname = (boundaddr, boundport)
- if ipaddr != None:
- self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
- else:
- self.__proxypeername = (destaddr, destport)
-
- def getproxysockname(self):
- """getsockname() -> address info
- Returns the bound IP address and port number at the proxy.
- """
- return self.__proxysockname
-
- def getproxypeername(self):
- """getproxypeername() -> address info
- Returns the IP and port number of the proxy.
- """
- return _orgsocket.getpeername(self)
-
- def getpeername(self):
- """getpeername() -> address info
- Returns the IP address and port number of the destination
- machine (note: getproxypeername returns the proxy)
- """
- return self.__proxypeername
-
- def __negotiatesocks4(self,destaddr,destport):
- """__negotiatesocks4(self,destaddr,destport)
- Negotiates a connection through a SOCKS4 server.
- """
- # Check if the destination address provided is an IP address
- rmtrslv = False
- try:
- ipaddr = socket.inet_aton(destaddr)
- except socket.error:
- # It's a DNS name. Check where it should be resolved.
- if self.__proxy[3]:
- ipaddr = struct.pack("BBBB", 0x00, 0x00, 0x00, 0x01)
- rmtrslv = True
- else:
- ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
- # Construct the request packet
- req = struct.pack(">BBH", 0x04, 0x01, destport) + ipaddr
- # The username parameter is considered userid for SOCKS4
- if self.__proxy[4] != None:
- req = req + self.__proxy[4]
- req = req + chr(0x00).encode()
- # DNS name if remote resolving is required
- # NOTE: This is actually an extension to the SOCKS4 protocol
- # called SOCKS4A and may not be supported in all cases.
- if rmtrslv:
- req = req + destaddr + chr(0x00).encode()
- self.sendall(req)
- # Get the response from the server
- resp = self.__recvall(8)
- if resp[0:1] != chr(0x00).encode():
- # Bad data
- self.close()
- raise GeneralProxyError((1,_generalerrors[1]))
- if resp[1:2] != chr(0x5A).encode():
- # Server returned an error
- self.close()
- if ord(resp[1:2]) in (91, 92, 93):
- self.close()
- raise Socks4Error((ord(resp[1:2]), _socks4errors[ord(resp[1:2]) - 90]))
- else:
- raise Socks4Error((94, _socks4errors[4]))
- # Get the bound address/port
- self.__proxysockname = (socket.inet_ntoa(resp[4:]), struct.unpack(">H", resp[2:4])[0])
- if rmtrslv != None:
- self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
- else:
- self.__proxypeername = (destaddr, destport)
-
- def __negotiatehttp(self, destaddr, destport):
- """__negotiatehttp(self,destaddr,destport)
- Negotiates a connection through an HTTP server.
- """
- # If we need to resolve locally, we do this now
- if not self.__proxy[3]:
- addr = socket.gethostbyname(destaddr)
- else:
- addr = destaddr
- self.sendall(("CONNECT " + addr + ":" + str(destport) + " HTTP/1.1\r\n" + "Host: " + destaddr + "\r\n\r\n").encode())
- # We read the response until we get the string "\r\n\r\n"
- resp = self.recv(1)
- while resp.find("\r\n\r\n".encode()) == -1:
- resp = resp + self.recv(1)
- # We just need the first line to check if the connection
- # was successful
- statusline = resp.splitlines()[0].split(" ".encode(), 2)
- if statusline[0] not in ("HTTP/1.0".encode(), "HTTP/1.1".encode()):
- self.close()
- raise GeneralProxyError((1, _generalerrors[1]))
- try:
- statuscode = int(statusline[1])
- except ValueError:
- self.close()
- raise GeneralProxyError((1, _generalerrors[1]))
- if statuscode != 200:
- self.close()
- raise HTTPError((statuscode, statusline[2]))
- self.__proxysockname = ("0.0.0.0", 0)
- self.__proxypeername = (addr, destport)
-
- def connect(self, destpair):
- """connect(self, despair)
- Connects to the specified destination through a proxy.
- destpar - A tuple of the IP/DNS address and the port number.
- (identical to socket's connect).
- To select the proxy server use setproxy().
- """
-
- # Do a minimal input check first
- if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):
- raise GeneralProxyError((5, _generalerrors[5]))
-
- # Don't proxy to ourselves..
- if destpair[0] == self.__proxy[1]:
- _orgsocket.connect(self, (destpair[0], destpair[1]))
- return
-
- if self.__proxy[0] == PROXY_TYPE_SOCKS5:
- if self.__proxy[2] != None:
- portnum = self.__proxy[2]
- else:
- portnum = 1080
- _orgsocket.connect(self, (self.__proxy[1], portnum))
- self.__negotiatesocks5(destpair[0], destpair[1])
- elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
- if self.__proxy[2] != None:
- portnum = self.__proxy[2]
- else:
- portnum = 1080
- _orgsocket.connect(self,(self.__proxy[1], portnum))
- self.__negotiatesocks4(destpair[0], destpair[1])
- elif self.__proxy[0] == PROXY_TYPE_HTTP:
- if self.__proxy[2] != None:
- portnum = self.__proxy[2]
- else:
- portnum = 8080
- _orgsocket.connect(self,(self.__proxy[1], portnum))
- self.__negotiatehttp(destpair[0], destpair[1])
- elif self.__proxy[0] == None:
- _orgsocket.connect(self, (destpair[0], destpair[1]))
- else:
- raise GeneralProxyError((4, _generalerrors[4]))
diff --git a/modules/sfp_crt.py b/modules/sfp_crt.py
index 751831d0..b5a31b11 100644
--- a/modules/sfp_crt.py
+++ b/modules/sfp_crt.py
@@ -46,7 +46,8 @@ class sfp_crt(SpiderFootPlugin):
def producedEvents(self):
return ["SSL_CERTIFICATE_RAW",
'INTERNET_NAME', 'INTERNET_NAME_UNRESOLVED', 'DOMAIN_NAME',
- 'AFFILIATE_INTERNET_NAME', 'AFFILIATE_INTERNET_NAME_UNRESOLVED', 'AFFILIATE_DOMAIN_NAME']
+ 'AFFILIATE_INTERNET_NAME', 'AFFILIATE_INTERNET_NAME_UNRESOLVED',
+ 'AFFILIATE_DOMAIN_NAME']
# Handle events sent to this module
def handleEvent(self, event):
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 14bf885e..00000000
--- a/setup.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-from distutils.core import setup
-import py2exe
-
-setup(
- console=['sf.py'],
- options={
- "py2exe": {
- "packages": ["modules", "ext.dns", "sflib", "sfwebui", "sfdb", "mako",
- "cherrypy", "netaddr", "ext.socks", "ext.PyPDF2",
- "ext.openxmllib", "ext.stem", "ext.whois", "pyOpenSSL",
- "phonenumbers", "ext.gexf", "bs4", "requests" ],
- "bundle_files": 1,
- "compressed": True,
- "includes": ['lxml._elementpath'],
- "dll_excludes": [ "w9xpopen.exe", "mswsock.dll", "powrprof.dll", "crypt32.dll", "mpr.dll" ]
- }
- },
- zipfile=None
-)
diff --git a/sf.py b/sf.py
index cd505190..e6ff8863 100755
--- a/sf.py
+++ b/sf.py
@@ -13,50 +13,11 @@
import sys
import os
-import inspect
+import os.path
import signal
import time
import argparse
from copy import deepcopy
-
-# Look under ext ford 3rd party dependencies
-cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0], "lib")))
-if cmd_subfolder not in sys.path:
- sys.path.insert(0, cmd_subfolder)
-
-deps = ['netaddr', 'dns', 'cherrypy', 'mako', 'socks', 'whois', 'OpenSSL',
- 'PyPDF2', 'stem', 'bs4', 'phonenumbers', 'ipaddr', 'ipwhois',
- 'networkx']
-for mod in deps:
- try:
- if mod.startswith("lib."):
- modname = mod.split('.')
- __import__('lib', fromlist=[modname[1]])
- else:
- __import__(mod)
- except ImportError as e:
- print("")
- print(("Critical Start-up Failure: " + str(e)))
- print("=================================")
- print("It appears you are missing a module required for SpiderFoot")
- print("to function. Please refer to the documentation for the list")
- print("of dependencies and install them.")
- print("")
- print("Python modules required are: ")
- for mod in deps:
- print((" - " + mod))
- print("")
- print("****************************************************************")
- print("Please note that if you are seeing this after doing a git pull")
- print("then you just need to do a `pip install -r requirements.txt` as")
- print("dependencies previously bundled with SpiderFoot are now")
- print("unbundled.")
- print("****************************************************************")
- print("")
- sys.exit(-1)
-
-import os
-import os.path
import cherrypy
import random
from cherrypy.lib import auth_digest
@@ -386,7 +347,7 @@ if __name__ == '__main__':
secrets = dict()
- pw = file(passwd_file, 'r')
+ pw = open(passwd_file, 'r')
for line in pw.readlines():
if ':' not in line:
diff --git a/sflib.py b/sflib.py
index 176ac7a9..ca38e338 100644
--- a/sflib.py
+++ b/sflib.py
@@ -16,7 +16,6 @@ from stem.control import Controller
import inspect
import hashlib
import urllib.request, urllib.parse, urllib.error
-import binascii
import json
import re
import os
@@ -28,7 +27,6 @@ import sys
import time
import netaddr
import urllib.request, urllib.error, urllib.parse
-import io
import threading
import traceback
import OpenSSL
@@ -39,7 +37,7 @@ from networkx import nx
from networkx.readwrite.gexf import GEXFWriter
from datetime import datetime
from bs4 import BeautifulSoup, SoupStrainer
-from copy import deepcopy, copy
+from copy import deepcopy
# For hiding the SSL warnings coming from the requests lib
import urllib3
@@ -303,25 +301,25 @@ class SpiderFoot:
#print(str(self.GUID) + ":" + str(level) + ":" + str(message) + ":" + str(component))
return self.dbh.scanLogEvent(self.GUID, level, message, component)
- def error(self, error, exception=True):
+ def error(self, message, exception=True):
if not self.opts['__logging']:
return None
if self.dbh is None:
- print(('[Error] ' + error))
+ print('[Error] %s' % message)
else:
- self._dblog("ERROR", error)
+ self._dblog("ERROR", message)
if self.opts.get('__logstdout'):
- print(("[Error] " + error))
+ print("[Error] %s" % message)
if exception:
- raise BaseException("Internal Error Encountered: " + error)
+ raise BaseException("Internal Error Encountered: " + message)
def fatal(self, error):
if self.dbh is None:
- print(('[Fatal] %s' % error))
+ print('[Fatal] %s' % error)
else:
self._dblog("FATAL", error)
- print((str(inspect.stack())))
+ print(str(inspect.stack()))
sys.exit(-1)
def status(self, message):
@@ -329,11 +327,11 @@ class SpiderFoot:
return None
if self.dbh is None:
- print(("[Status] %s" % message))
+ print("[Status] %s" % message)
else:
self._dblog("STATUS", message)
if self.opts.get('__logstdout'):
- print(("[*] %s" % message))
+ print("[*] %s" % message)
def info(self, message):
if not self.opts['__logging']:
@@ -356,11 +354,11 @@ class SpiderFoot:
modName = mod.__name__
if self.dbh is None:
- print(('[%s] %s' % (modName, message)))
+ print('[%s] %s' % (modName, message))
else:
self._dblog("INFO", message, modName)
if self.opts.get('__logstdout'):
- print(("[*] %s" % message))
+ print("[*] %s" % message)
return
def debug(self, message):
@@ -385,11 +383,11 @@ class SpiderFoot:
modName = mod.__name__
if self.dbh is None:
- print(('[%s] %s' % (modName, message)))
+ print('[%s] %s' % (modName, message))
else:
self._dblog("DEBUG", message, modName)
if self.opts.get('__logstdout'):
- print(("[d:%s] %s" % (modName, message)))
+ print("[d:%s] %s" % (modName, message))
return
def myPath(self):
@@ -1079,17 +1077,17 @@ class SpiderFoot:
sslcert_dump = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_TEXT, sslcert)
ret['text'] = sslcert_dump.decode('utf-8', errors='replace')
- ret['issuer'] = cert.issuer.rfc4514_string()
+ ret['issuer'] = str(cert.issuer)
ret['altnames'] = list()
ret['expired'] = False
ret['expiring'] = False
ret['mismatch'] = False
ret['certerror'] = False
- ret['issued'] = cert.subject.rfc4514_string()
+ ret['issued'] = str(cert.subject)
# Expiry info
try:
- notafter = datetime.strptime(sslcert.get_notAfter(), "%Y%m%d%H%M%SZ")
+ notafter = datetime.strptime(str(sslcert.get_notAfter()), "%Y%m%d%H%M%SZ")
ret['expiry'] = int(notafter.strftime("%s"))
ret['expirystr'] = notafter.strftime("%Y-%m-%d %H:%M:%S")
now = int(time.time())
@@ -1933,9 +1931,9 @@ class SpiderFootEvent(object):
self.sourceEvent = sourceEvent
if type(data) != str and type(data) != str:
- print(("FATAL: Only string events are accepted, not '%s'." % type(data)))
- print(("FATAL: Offending module: %s" % module))
- print(("FATAL: Offending type: %s" % eventType))
+ print("FATAL: Only string events are accepted, not '%s'." % type(data))
+ print("FATAL: Offending module: %s" % module)
+ print("FATAL: Offending type: %s" % eventType)
sys.exit(-1)
if type(data) != str and data != None:
@@ -1950,9 +1948,9 @@ class SpiderFootEvent(object):
return
if type(sourceEvent) != SpiderFootEvent:
- print(("FATAL: Invalid source event: %s" % sourceEvent))
- print(("FATAL: Offending module: %s" % module))
- print(("FATAL: Offending type: %s" % eventType))
+ print("FATAL: Invalid source event: %s" % sourceEvent)
+ print("FATAL: Offending module: %s" % module)
+ print("FATAL: Offending type: %s" % eventType)
sys.exit(-1)
self.sourceEventHash = sourceEvent.getHash()
diff --git a/sfscan.py b/sfscan.py
index 780c95de..2cf2a94c 100644
--- a/sfscan.py
+++ b/sfscan.py
@@ -12,12 +12,11 @@
import traceback
import time
import sys
-import socks
import socket
import dns.resolver
import threading
import random
-from copy import deepcopy, copy
+from copy import deepcopy
from sfdb import SpiderFootDb
from sflib import SpiderFoot, SpiderFootEvent, SpiderFootTarget, \
SpiderFootPlugin, globalScanStatus
diff --git a/sfwebui.py b/sfwebui.py
index 2faed08b..5afe54ba 100644
--- a/sfwebui.py
+++ b/sfwebui.py
@@ -193,7 +193,7 @@ class SpiderFootWebUi:
if row[10] == "ROOT":
continue
datafield = str(row[1]).replace("<SFURL>", "").replace("</SFURL>", "")
- parser.writerow([row[0], str(row[10]), str(row[3]), str(row[2]), row[13], datafield])
+ parser.writerow([row[0], str(row[10]), str(row[3]), str(row[2]), row[11], datafield])
cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"
cherrypy.response.headers['Content-Type'] = "application/csv"
cherrypy.response.headers['Pragma'] = "no-cache"
@@ -534,7 +534,7 @@ class SpiderFootWebUi:
if confirm is not None:
dbh.scanInstanceDelete(id)
if not raw:
- raise cherrypy.HTTPRedirect(self.docroot)
+ raise cherrypy.HTTPRedirect("/")
else:
return json.dumps(["SUCCESS", ""])
else:
@@ -562,7 +562,7 @@ class SpiderFootWebUi:
if confirm is not None:
for id in ids.split(','):
dbh.scanInstanceDelete(id)
- raise cherrypy.HTTPRedirect(self.docroot)
+ raise cherrypy.HTTPRedirect("/")
else:
templ = Template(filename='dyn/scandelete.tmpl', lookup=self.lookup)
return templ.render(id=None, name=None, ids=ids.split(','), names=names,