class NamecoinDomainExtended(metaclass=Schema): name = 'Namecoin schema: Extended schema interpretation' Header = NamecoinDomainExplorer SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.domain}) SchemaTxid = SchemaObject(NamecoinTXid, mapping={ NamecoinTXid.txid: Header.txid, NamecoinTXid.txid_short: Header.short_txid }) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)]) SchemaTxidToDomain = NamecoinTXidToDomain.between( SchemaTxid, SchemaDomain, mapping={NamecoinTXidToDomain.DateTime: Header.date_time}, conditions=[not_empty(Header.domain)]) SchemaTxidToIP = NamecoinTXidToIP.between( SchemaTxid, SchemaIP, mapping={NamecoinTXidToIP.DateTime: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)])
class ASNSchema1(metaclass=Schema): name = f'Schema: Netblock, IP, Country and ASN' Header = IPandASN SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaNetBlock = SchemaObject( Netblock, mapping={Netblock.Netblock: Header.Announced_Prefix}) SchemaCountry = SchemaObject(Country, mapping={Country.Country: Header.Country}) SchemaCountry.set_properties( image_source=IPandASN.Country_flag.system_name) SchemaAutonomousSystem = SchemaObject( AutonomousSystem, mapping={AutonomousSystem.ASN: Header.ASN}) Connection = IPToNetblock.between(SchemaIP, SchemaNetBlock, {}, [ Condition(Header.ip, Operations.NotEqual, ''), Condition(Header.Announced_Prefix, Operations.NotEqual, '') ]) LinkNetblockToAutonomousSystem = NetblockToAutonomousSystem.between( SchemaNetBlock, SchemaAutonomousSystem, {}, [ Condition(Header.ip, Operations.NotEqual, ''), Condition(Header.ASN, Operations.NotEqual, '') ]) LinkAutonomousSystemToCountry = AutonomousSystemToCountry.between( SchemaAutonomousSystem, SchemaCountry, mapping={AutonomousSystemToCountry.Value: Header.ASN_Name})
class NamecoinNamecoinTxtoNamecoinAddress(metaclass=Schema): name = f'Namecoin schema: Namecoin transaction {Constants.RIGHTWARDS_ARROW} other(address, domain, ip)' Header = NamecoinTXnExplorer_out SchemaNamecoinTXid = SchemaObject(NamecoinTXid, mapping={ NamecoinTXid.txid: Header.txid, NamecoinTXid.txid_short: Header.short_txid }) SchemaAddress = SchemaObject(NamecoinAddress, mapping={ NamecoinAddress.namecoint_address: Header.address, NamecoinAddress.namecoint_address_short: Header.short_address }) SchemaSchemaNamecoinTXid_to_SchemaAddress = NamecoinTXidToAddress.between( SchemaNamecoinTXid, SchemaAddress, mapping={ NamecoinTXidToAddress.DateTime: Header.date_time, NamecoinTXidToAddress.Operation: Header.nameOp, NamecoinTXidToAddress.Domain: Header.raw_name, NamecoinTXidToAddress.Value: Header.value }) SchemaDomain = SchemaObject( Domain, mapping={Domain.Domain: Header.namecoin_domain}) SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaAddressToIP = NamecoinAddressToIP.between( SchemaAddress, SchemaIP, mapping={NamecoinAddressToIP.DateTime: Header.date_time}, conditions=[not_empty(Header.ip)]) SchemaAddressToDomain = NamecoinAddressToDomain.between( SchemaAddress, SchemaDomain, mapping={NamecoinAddressToDomain.DateTime: Header.date_time}, conditions=[not_empty(Header.namecoin_domain)]) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.namecoin_domain), not_empty(Header.ip)])
class NamecoinDomainIP(metaclass=Schema): name = 'Namecoin schema: Domain and IP' Header = NamecoinDomainExplorer SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.domain}) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)])
class NamecoinNamecoinTxtoNamecoinTx(metaclass=Schema): name = f'Namecoin schema: Namecoin transaction {Constants.RIGHTWARDS_ARROW} Namecoin transaction' Header = NamecoinTXnExplorer_in SchemaNamecoinTXid_1 = SchemaObject(NamecoinTXid, mapping={NamecoinTXid.txid: Header.txid, NamecoinTXid.txid_short: Header.short_txid}) SchemaNamecoinTXid_2 = SchemaObject(NamecoinTXid, mapping={NamecoinTXid.txid: Header.txid_in, NamecoinTXid.txid_short: Header.short_txid_in}) SchemaNamecoinTXidToNamecoinTXid = NamecoinTXidToNamecoinTXid.between( SchemaNamecoinTXid_2, SchemaNamecoinTXid_1, mapping={NamecoinTXidToNamecoinTXid.DateTime: Header.date_time})
class SchemaLocationGeohash(metaclass=Schema): name = 'Schema: Locations and Geohash' Header = GoogleTextSearchPlaces SchemaLocationObject = SchemaObject(Location, mapping={Location.Name: Header.formatted_address, Location.Address: Header.name_address, Location.Latitude: Header.lat, Location.Longitude: Header.lon, Location.Geohash: Header.geohash, Location.GeoPoint:[Header.lat, Header.lon]}) SchemaGeohash = SchemaObject(GeoHash, mapping={GeoHash.geohash: Header.geohash, GeoHash.geohash_size: Header.geohash_size}) SchemaLocationToGeohash = LocationToGeohash.between(SchemaLocationObject, SchemaGeohash, mapping={LocationToGeohash.Desc: Header.name_address}, conditions=[not_empty(Header.name_address)])
class DomainToSubDomainUniq(metaclass=Schema): name = 'Domains, Subdomains' Header = TableUniqueSubDomains SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.search_domain}) SchemaSubDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.subdomain}) SchemaDomainToDomain = DomainToDomain.between( SchemaDomain, SchemaSubDomain, mapping={DomainToDomain.RelationType: Header.search_domain}, conditions=[ not_empty(Header.search_domain), not_empty(Header.subdomain) ])
class DomainToSubDomainDate(metaclass=Schema): name = 'Domains, Subdomains:timeline' Header = TableSubDomains SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.search_domain}) SchemaSubDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.subdomain}) SchemaDomainToDomain = DomainToDomainWithDate.between( SchemaDomain, SchemaSubDomain, mapping={DomainToDomainWithDate.DateTime: Header.DateTimeField}, conditions=[ not_empty(Header.search_domain), not_empty(Header.subdomain) ])
class SchemaNamecoinUnioanTxAddressValues(metaclass=Schema): name = f'Namecoin schemas: \n1. transaction {Constants.RIGHTWARDS_ARROW} address(value)\n2. address(value) {Constants.LEFTWARDS_ARROW} transaction' Header = UnionTxAddress SchemaNamecoinTXid = SchemaObject(NamecoinTXid, mapping={ NamecoinTXid.txid: Header.txid, NamecoinTXid.txid_short: Header.short_txid }) SchemaAddress1 = SchemaObject(NamecoinAddress, mapping={ NamecoinAddress.namecoint_address: Header.address, NamecoinAddress.namecoint_address_short: Header.short_address }) SchemaAddress2 = SchemaObject(NamecoinAddress, mapping={ NamecoinAddress.namecoint_address: Header.address, NamecoinAddress.namecoint_address_short: Header.short_address }) SchemaLinkTxtoAddressValues = NamecoinTXidToAddressValue.between( SchemaNamecoinTXid, SchemaAddress1, mapping={ NamecoinTXidToAddressValue.DateTime: Header.date_time, NamecoinTXidToAddressValue.Value: Header.value }, conditions=[check_direction_1(Header.direction)]) SchemaLinkAddresstoTxValues = NamecoinAddressToTXidValue.between( SchemaAddress2, SchemaNamecoinTXid, mapping={ NamecoinAddressToTXidValue.DateTime: Header.date_time, NamecoinAddressToTXidValue.Value: Header.value }, conditions=[check_direction_2(Header.direction)])
class SchemaLocation(metaclass=Schema): name = 'Google: Locations' Header = GoogleTextSearchPlaces SchemaLocationObject = SchemaObject(Location, mapping={Location.Name: Header.formatted_address, Location.Address: Header.name_address, Location.Latitude: Header.lat, Location.Longitude: Header.lon, Location.Geohash: Header.geohash, Location.GeoPoint:[Header.lat, Header.lon]})
class NamecoinDomainIPBlock(metaclass=Schema): name = 'Namecoin schema: Netblock, Domain and IP' Header = NamecoinDomainExplorer SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.domain}) Block = Netblock.schematic(Header) Connection = IPToNetblock.between(SchemaIP, Block, {}, [ Condition(Header.ip, Operations.NotEqual, ''), Condition(Header.Netblock, Operations.NotEqual, '') ]) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)])
class NamecoinDomainIPBlock(metaclass=Schema): name = f'Namecoin schema: Netblock, IP {Constants.RIGHTWARDS_ARROW} Domain' Header = NamecoinDomainExplorer SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.domain}) SchemaBlock = SchemaObject(Netblock, mapping={Netblock.Netblock: Header.Netblock}) Connection = IPToNetblock.between(SchemaIP, SchemaBlock, {}, [ Condition(Header.ip, Operations.NotEqual, ''), Condition(Header.Netblock, Operations.NotEqual, '') ]) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)])
class NFSSchema(metaclass=Schema): name = 'NFS Schema' Header = NFSHeader # region Schema objects SchemaIP_Search = SchemaObject(IP, mapping={IP.IP: Header.host_query}) SchemaIP_granted = SchemaObject(IP, mapping={IP.IP: Header.ipv4}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.host}) SchemaShareNFS = SchemaObject(ShareNFS, mapping={ShareNFS.FilePath: [Header.host_query, Header.shared_path], ShareNFS.Filename:Header.shared_path}) SchemaEntity = SchemaObject(Entity, mapping={Entity.Value: Header.status}) SchemaNetblock = SchemaObject(Netblock, mapping={Netblock.Netblock: Header.network_v4}) # endregion # region Schema links SchemaLink_DirToIP = ShareNFSToIP.between(SchemaShareNFS, SchemaIP_Search, mapping={ShareNFSToIP.DateTime: Header.current_day}, conditions=[not_empty(Header.host_query)]) SchemaLink_IPtoDir = IPToShareNFS.between(SchemaIP_granted, SchemaShareNFS, mapping={IPToShareNFS.DateTime: Header.current_day}, conditions=[not_empty(Header.ipv4)]) SchemaLink_NetblockToDir = NetblockToShareNFS.between(SchemaNetblock, SchemaShareNFS, mapping={NetblockToShareNFS.DateTime: Header.current_day}, conditions=[not_empty(Header.network_v4)]) SchemaLink_EntityToDir = EntityToShareNFS.between(SchemaEntity, SchemaShareNFS, mapping={EntityToShareNFS.DateTime: Header.current_day}, conditions=[not_empty(Header.status)]) SchemaLink_DomainToDir = DomainToShareNFS.between(SchemaDomain, SchemaShareNFS, mapping={DomainToShareNFS.DateTime: Header.current_day}, conditions=[not_empty(Header.host)])
class NamecoinDomainBlocksExtended(metaclass=Schema): name = f'Namecoin schema: Netblock, IP {Constants.RIGHTWARDS_ARROW} Domain (ext.)' Header = NamecoinDomainExplorer SchemaIP = SchemaObject(IP, mapping={IP.IP: Header.ip}) SchemaDomain = SchemaObject(Domain, mapping={Domain.Domain: Header.domain}) SchemaTxid = SchemaObject(NamecoinTXid, mapping={ NamecoinTXid.txid: Header.txid, NamecoinTXid.txid_short: Header.short_txid }) SchemaBlock = SchemaObject(Netblock, mapping={Netblock.Netblock: Header.Netblock}) Connection = IPToNetblock.between(SchemaIP, SchemaBlock, {}, [ Condition(Header.ip, Operations.NotEqual, ''), Condition(Header.Netblock, Operations.NotEqual, '') ]) SchemaIPToDomain = IPToDomain.between( SchemaIP, SchemaDomain, mapping={IPToDomain.Resolved: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)]) SchemaTxidToDomain = NamecoinTXidToDomain.between( SchemaTxid, SchemaDomain, mapping={NamecoinTXidToDomain.DateTime: Header.date_time}, conditions=[not_empty(Header.domain)]) SchemaTxidToIP = NamecoinTXidToIP.between( SchemaTxid, SchemaIP, mapping={NamecoinTXidToIP.DateTime: Header.date_time}, conditions=[not_empty(Header.domain), not_empty(Header.ip)])