Skip to content

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

Assignment Simplification

Gormogond508b4fa5245
diff --git a/ext/dns/dnssec.py b/ext/dns/dnssec.py
index f10fb930..8cbc6e32 100644
--- a/ext/dns/dnssec.py
+++ b/ext/dns/dnssec.py
@@ -299,9 +299,9 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
if _is_rsa(rrsig.algorithm):
# PKCS1 algorithm identifier goop
- digest = _make_algorithm_id(rrsig.algorithm) + digest
+ digest += _make_algorithm_id(rrsig.algorithm)
padlen = keylen // 8 - len(digest) - 3
- digest = chr(0) + chr(1) + chr(0xFF) * padlen + chr(0) + digest
+ digest += chr(0) + chr(1) + chr(0xFF) * padlen + chr(0)
elif _is_dsa(rrsig.algorithm):
pass
else:
diff --git a/ext/dns/e164.py b/ext/dns/e164.py
index 68f0a316..cffe75b1 100644
--- a/ext/dns/e164.py
+++ b/ext/dns/e164.py
@@ -58,7 +58,7 @@ def to_e164(name, origin=public_enum_domain, want_plus_prefix=True):
dlabels.reverse()
text = ''.join(dlabels)
if want_plus_prefix:
- text = '+' + text
+ text += '+'
return text
def query(number, domains, resolver=None):
diff --git a/ext/dns/ipv6.py b/ext/dns/ipv6.py
index 1ab00da9..fd78f483 100644
--- a/ext/dns/ipv6.py
+++ b/ext/dns/ipv6.py
@@ -148,7 +148,7 @@ def inet_aton(text):
if lc > 4:
raise dns.exception.SyntaxError
if lc != 4:
- c = ('0' * (4 - lc)) + c
+ c += ('0' * (4 - lc))
canonical.append(c)
if l < 8 and not seen_empty:
raise dns.exception.SyntaxError
diff --git a/ext/dns/message.py b/ext/dns/message.py
index 52c0eaea..8d7b8bcd 100644
--- a/ext/dns/message.py
+++ b/ext/dns/message.py
@@ -606,7 +606,7 @@ class _WireReader(object):
(rdtype, rdclass) = \
struct.unpack('!HH',
self.wire[self.current:self.current + 4])
- self.current = self.current + 4
+ self.current += 4
self.message.find_rrset(self.message.question, qname,
rdclass, rdtype, create=True,
force_unique=True)
@@ -636,7 +636,7 @@ class _WireReader(object):
(rdtype, rdclass, ttl, rdlen) = \
struct.unpack('!HHIH',
self.wire[self.current:self.current + 10])
- self.current = self.current + 10
+ self.current += 10
if rdtype == dns.rdatatype.OPT:
if not section is self.message.additional or seen_opt:
raise BadEDNS
@@ -650,7 +650,7 @@ class _WireReader(object):
(otype, olen) = \
struct.unpack('!HH',
self.wire[current:current + 4])
- current = current + 4
+ current += 4
opt = dns.edns.option_from_wire(otype, self.wire, current, olen)
self.message.options.append(opt)
current = current + olen
@@ -831,8 +831,7 @@ class _TextReader(object):
self.updating = True
elif what == 'edns':
self.message.edns = self.tok.get_int()
- self.message.ednsflags = self.message.ednsflags | \
- (self.message.edns << 16)
+ self.message.ednsflags |= self.message.edns << 16
elif what == 'eflags':
if self.message.edns < 0:
self.message.edns = 0
diff --git a/ext/dns/query.py b/ext/dns/query.py
index 7a1b1f49..4b2ea9f7 100644
--- a/ext/dns/query.py
+++ b/ext/dns/query.py
@@ -244,7 +244,7 @@ def _net_read(sock, count, expiration):
n = sock.recv(count)
if n == '':
raise EOFError
- count = count - len(n)
+ count -= len(n)
s = s + n
return s
diff --git a/ext/exifread/classes.py b/ext/exifread/classes.py
index 0876b4ce..dfafc07a 100644
--- a/ext/exifread/classes.py
+++ b/ext/exifread/classes.py
@@ -90,8 +90,8 @@ class ExifHeader:
if self.endian == 'I':
s += chr(offset & 0xFF)
else:
- s = chr(offset & 0xFF) + s
- offset = offset >> 8
+ s += chr(offset & 0xFF)
+ offset >>= 8
return s
def _first_ifd(self):
diff --git a/ext/exifread/utils.py b/ext/exifread/utils.py
index ed4c8daf..f6cbb3c3 100644
--- a/ext/exifread/utils.py
+++ b/ext/exifread/utils.py
@@ -51,7 +51,7 @@ def s2n_intel(string):
x = 0
y = 0
for c in string:
- x = x | (ord_(c) << y)
+ x |= ord_(c) << y
y += + 8
return x
diff --git a/ext/pyPdf/pdf.py b/ext/pyPdf/pdf.py
index bf60d015..6e3fbd41 100644
--- a/ext/pyPdf/pdf.py
+++ b/ext/pyPdf/pdf.py
@@ -1695,7 +1695,7 @@ class Destination(DictionaryObject):
def convertToInt(d, size):
if size > 8:
raise utils.PdfReadError("invalid size in convertToInt")
- d = "\x00\x00\x00\x00\x00\x00\x00\x00" + d
+ d += "\x00\x00\x00\x00\x00\x00\x00\x00"
d = d[-8:]
return struct.unpack(">q", d)[0]
diff --git a/ext/pyPdf/utils.py b/ext/pyPdf/utils.py
index 7c1d472d..98eb7a2a 100644
--- a/ext/pyPdf/utils.py
+++ b/ext/pyPdf/utils.py
@@ -78,7 +78,7 @@ class ConvertFunctionsToVirtualList(object):
len_self = len(self)
if index < 0:
# support negative indexes
- index = len_self + index
+ index += len_self
if index < 0 or index >= len_self:
raise IndexError, "sequence index out of range"
return self.getFunction(index)
diff --git a/ext/socks.py b/ext/socks.py
index 308eb783..d68b2ad1 100644
--- a/ext/socks.py
+++ b/ext/socks.py
@@ -228,7 +228,7 @@ class socksocket(socket.socket):
# Resolve locally
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
req = req + chr(0x01).encode() + ipaddr
- req = req + struct.pack(">H", destport)
+ req += struct.pack(">H", destport)
self.sendall(req)
# Get the response
resp = self.__recvall(4)
@@ -297,7 +297,7 @@ class socksocket(socket.socket):
# The username parameter is considered userid for SOCKS4
if self.__proxy[4] != None:
req = req + self.__proxy[4]
- req = req + chr(0x00).encode()
+ 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.
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index daae55b0..620fb7d8 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -225,13 +225,13 @@ class sfp_dns(SpiderFootPlugin):
return None
if self.hostresults.has_key(sip):
- s = s + 1
+ s += 1
continue
addrs = self.resolveIP(sip)
if len(addrs) == 0:
self.sf.debug("Look-aside resolve for " + sip + " failed.")
- s = s + 1
+ s += 1
continue
# Report addresses that resolve to hostnames on the same
@@ -246,7 +246,7 @@ class sfp_dns(SpiderFootPlugin):
self.processHost(sip, parentEvent, affiliate=False)
else:
self.processHost(sip, parentEvent, affiliate=True)
- s = s + 1
+ s += 1
return None
# Resolve an IP
diff --git a/modules/sfp_names.py b/modules/sfp_names.py
index 5e161c36..5cd242eb 100644
--- a/modules/sfp_names.py
+++ b/modules/sfp_names.py
@@ -83,7 +83,7 @@ class sfp_names(SpiderFootPlugin):
self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)
# Stage 1: Find things that look (very vaguely) like names
- rx = re.compile("([A-Z][a-z�������������]+)\s+.?.?\s?([A-Z][�������������a-zA-Z\'\-]+)")
+ rx = re.compile("([A-Z][a-z�������������]+)\s+.?.?\s?([A-Z][�������������a-zA-Z\'\-]+)")
m = re.findall(rx, eventData)
for r in m:
# Start off each match as 0 points.
@@ -103,31 +103,31 @@ class sfp_names(SpiderFootPlugin):
# If both words are not in the dictionary, add 75 points.
if first not in self.d and second not in self.d:
- p = p + 75
+ p += 75
notindict = True
# If the first word is a known popular first name, award 50 points.
if first in self.n:
- p = p + 50
+ p += 50
# If either word is 2 characters, subtract 50 points.
if len(first) == 2 or len(second) == 2:
- p = p - 50
+ p -= 50
# If the first word is in our cue list, knock out more points.
if first in self.fq:
- p = p - 50
+ p -= 50
# If the first word is in the dictionary but the second isn't,
# subtract 40 points.
if notindict == False:
if first in self.d and second not in self.d:
- p = p - 20
+ p -= 20
# If the second word is in the dictionary but the first isn't,
# reduce 20 points.
if first not in self.d and second in self.d:
- p = p - 40
+ p -= 40
name = r[0] + " " + secondOrig
diff --git a/sfdb.py b/sfdb.py
index 5e44e637..566b412a 100644
--- a/sfdb.py
+++ b/sfdb.py
@@ -254,7 +254,7 @@ class SpiderFootDb:
qry += " AND c.data REGEXP ? "
qvars.append(criteria['regex'])
- qry = qry + " ORDER BY c.data"
+ qry += " ORDER BY c.data"
try:
self.dbh.execute(qry, qvars)
@@ -399,10 +399,10 @@ class SpiderFootDb:
qvars = [instanceId]
if eventType != "ALL":
- qry = qry + " AND c.type = ?"
+ qry += " AND c.type = ?"
qvars.append(eventType)
- qry = qry + " ORDER BY c.data"
+ qry += " ORDER BY c.data"
try:
self.dbh.execute(qry, qvars)
@@ -418,10 +418,10 @@ class SpiderFootDb:
qvars = [instanceId]
if eventType != "ALL":
- qry = qry + " AND type = ?"
+ qry += " AND type = ?"
qvars.append(eventType)
- qry = qry + " GROUP BY type, data ORDER BY COUNT(*)"
+ qry += " GROUP BY type, data ORDER BY COUNT(*)"
try:
self.dbh.execute(qry, qvars)
@@ -438,7 +438,7 @@ class SpiderFootDb:
qvars = [instanceId]
if limit != None:
- qry = qry + " LIMIT ?"
+ qry += " LIMIT ?"
qvars.append(limit)
try:
@@ -456,7 +456,7 @@ class SpiderFootDb:
qvars = [instanceId]
if limit != None:
- qry = qry + " LIMIT ?"
+ qry += " LIMIT ?"
qvars.append(limit)
try:
@@ -669,7 +669,7 @@ class SpiderFootDb:
for hashId in elementIdList:
qry = qry + "'" + hashId + "',"
- qry = qry + "'')"
+ qry += "'')"
try:
self.dbh.execute(qry, qvars)