async def do10Formatting(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: ''' The same as do10AutoAdds without the adds (to isolate the autoadd part) ''' q = "inet:ipv4 $val=$lib.str.format('{num}.rev', num=$(1000000-$node.value()))" count = await acount(prox.eval(q)) assert count == self.workfactor return self.workfactor
async def do09DelNodes(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:url | delnode')) assert count == 0 return self.workfactor
async def do10AutoAdds(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: q = "inet:ipv4 $val=$lib.str.format('{num}.rev', num=$(1000000-$node.value())) [:dns:rev=$val]" count = await acount(prox.eval(q)) assert count == self.workfactor return self.workfactor
async def do05PivotAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4#odd -> inet:dns:a')) assert count == 0 return self.workfactor // 2
async def do06PivotPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4#even -> inet:dns:a')) assert count == self.workfactor // 2 + self.workfactor // 10 return count
async def do04LiftByTagAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4#newp')) assert count == 0 return 1
async def do04LiftByTagPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4#even')) assert count == self.workfactor // 2 return count
async def do03LiftBySecondaryAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:dns:a:fqdn=newp')) assert count == 0 return 1
async def do03LiftBySecondaryPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:dns:a:fqdn=blackhole.website')) assert count == self.workfactor // 10 return count
async def do02LiftSimple(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4')) assert count == self.workfactor return count
async def do02LiftFilterPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4 | +#all')) assert count == self.workfactor return count
async def do01SimpleCount(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4 | count | spin')) assert count == 0 return self.workfactor
async def do00EmptyQuery(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: for _ in range(self.workfactor // 10): count = await acount(prox.eval('')) assert count == 0 return self.workfactor // 10
async def do10SlashAdds(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: q = '[ inet:ipv4=1.2.0.0/16 ] | spin' count = await acount(prox.eval(q, opts=self.opts)) assert count == 0 return 2 ** 16
async def do02LiftFilterAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: count = await acount(prox.eval('inet:ipv4 | +#newp', opts=self.opts)) assert count == 0 return 1
async def do00NewQuery(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int: for i in range(self.workfactor): count = await acount(prox.eval(f'$x={i}', opts=self.opts)) assert count == 0 return self.workfactor