MatchMeta.Info

Full paths of directories and filenames are hashed using the SHA256 algorithm to generate a ‘Meta Hash‘ for comparison.

Directory Examples:
/var/log/unattended-upgrades
C:\Program Files\Microsoft Office

Filename Examples:
/home/user/.bash_history
C:\Users\Administrator\NTUSER.DAT

The full path of a file or directory should be normalized before a ‘MatchMeta.Info‘ restful API request initiates.

Python Example:

import hashlib
import requests

path = r'/home/john/.bash_history'

if path[:1] == '/': ### UNIX
    out = path.split('/')
    if out[1] == 'home':
        out[2] = 'user'
        path = '/'.join(out)
    elif path[1] == ':': ### WINDOWS
        new = list(path)
        new[0] = 'C'
        path = (''.join(new))
        out = path.split('\\')
        if out[1] == 'Users' or out[1] == 'Documents and Settings':
            if out[2] != 'Default' and out[2] != 'Public' and out[2] != 'All Users' and out[2] != 'Default User':
                out[2] = 'Administrator'
                path = '\\'.join(out)

hash_object = hashlib.sha256(path.encode())
hash_value = hash_object.hexdigest()

r = requests.get('https://api.matchmeta.info/sha256/name/'+hash_value.upper(), headers={'x-api-key': 'Q8uUcDwyXa3lvPodKDcbp3zFZjlNMTL17qSfteiY'})

print(r.text)

JSON Output:

{"meta":[{"sha256":"8DBD9A40F9F2353D9749B0C1794171484F8292D7AEA7F960896354A0E9DC42D5","md5":"A9BABCE0C70D1A1D3CC9A9DBB9806076","os":"UBUNTU18","type":"KNOWN","source":"FILE","sha256file":"3D3A005489E6B68737523BCF53B94DDF32EE50FD0781D41DDE8741B32EB959C7","md5file":"7F6DA2DEB792B870C80F0C064C481C1B","desc":"/home/user/.bash_history"}]}

File contents are hashed using the SHA256 algorithm if the size is greater than 0 and less than 100 MB.

matchmeta

The ‘asyncio‘ python libraries provide improved performance to read a line delimited file, make a web request and write the results to disk.

Python Example:

import aiofiles
import aiohttp
import asyncio
import async_timeout

inputfile = 'input.txt'
outputfile = 'output.txt'

key = 'Q8uUcDwyXa3lvPodKDcbp3zFZjlNMTL17qSfteiY'
connection = aiohttp.TCPConnector(ssl=False)

async def fetch(session, url):
    with async_timeout.timeout(10):
        async with session.get(url,headers={'x-api-key':key}) as response:
            return await response.text()

async def main(loop):
    async with aiohttp.ClientSession(loop=loop,connector=connection) as session:
        async with aiofiles.open(inputfile,'r') as f:
            async with aiofiles.open(outputfile,'w') as w:
                async for line in f:
                    url = 'https://api.matchmeta.info/sha256/name/'+str(line[:-1])
                    jsonouput = await fetch(session,url)
                    await w.write(jsonouput+'\n')

loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

Amazon Web Services (AWS) cloud workloads are used to keep the ‘self-sustaining‘ library updated.

Current:
Microsoft Windows Server 2019
Office 365 Home Edition
Ubuntu Server 18.04 LTS

Retired:
Amazon Linux 2
Amazon Linux 1
Microsoft Windows Server 2016
Microsoft Windows Server 2012 R2
Microsoft Windows Server 2008 R2
Microsoft Windows Server 2003 R2
Red Hat Enterprise Linux 8
Ubuntu Server 16.04 LTS
Ubuntu Server 14.04 LTS

 


Copyright (c) 2014-2019 John Lukach

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.