You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can only seem to insert ipv4 into my files otherwise they become unreadable. If I write all ipv4 and even a single ipv6 the lookup using a maxmind reader fails (no errors, just empty results).
I believe the issue I am having is in how I am adding the ipv4 addresses.
importosimportmmdbencoderOUTPUT_MMDB_FILENAME='output.mmdb'ifos.path.isfile(OUTPUT_MMDB_FILENAME):
print("WARNING: Deleting Old MMDB File")
os.remove(OUTPUT_MMDB_FILENAME)
mmdb_file=open(OUTPUT_MMDB_FILENAME, 'wb');
enc=mmdbencoder.Encoder(
# Using 0th index6,
32,
'suspect',
['en'], # Languages
{'en': 'Description...'}, # Descriptioncompat=True)
# Remove the ipv6 and the ipv4 are readable, add them and only ipv6 are readableips= [
'216.244.66.248',
'3.15.9.167',
'2a02:587:a12:f000:e9bf:9b70:4fd:c66',
'2002:b9ea:da6b:0:0:0:b9ea:da6b',
'192.0.91.147'
]
# just the same for all of these...data=enc.insert_data({'region': 'United States', 'type': 'attack_source'})
foripinips:
try:
enc.insert_network(ip, data)
exceptExceptionase:
print("ERROR: Got error while adding row to the mmdb file. Details are below")
print("-----: Error: {}".format(str(e)))
enc.write(mmdb_file)
print("Done")
There was some confusion in the Official Perl writer as well but I can't seem to figure out any ipv6 representation of an ipv4 that works such as:
I can only seem to insert ipv4 into my files otherwise they become unreadable. If I write all ipv4 and even a single ipv6 the lookup using a maxmind reader fails (no errors, just empty results).
I believe the issue I am having is in how I am adding the ipv4 addresses.
There was some confusion in the Official Perl writer as well but I can't seem to figure out any ipv6 representation of an ipv4 that works such as:
maxmind/MaxMind-DB-Writer-perl#44 (comment)
The text was updated successfully, but these errors were encountered: