parser.add_argument("--software", help="Name of software, e.g. 'lemmy'")
parser.add_argument("--force", action="store_true", help="Include also already existing instances, otherwise only new are checked")
parser.add_argument("--delete-unwanted", action="store_true", help="Whether delete or keep (default) unwanted domains")
+ parser.add_argument("--no-obfuscation", action="store_true", help="Check instances with no obfuscation of blocked instances")
### Fetch blocks from registered instances or given ###
parser = subparser_command.add_parser(
if isinstance(args.domain, str) and args.domain != "" and domain_helper.is_wanted(args.domain):
logger.debug("Fetching record for args.domain='%s' ...", args.domain)
- database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND domain = ?", [args.domain])
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND domain = ? ORDER BY last_blocked ASC", [args.domain])
elif isinstance(args.software, str) and args.software != "" and validators.domain(args.software, rfc_2782=True) == args.software:
logger.debug("Fetching records for args.software='%s' ...", args.software)
- database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND software = ?", [args.software])
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND software = ? ORDER BY last_blocked ASC", [args.software])
+ elif args.no_obfuscation:
+ logger.debug("Fetching records with no obfuscation of blocked domain ...")
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 0 AND total_blocks > 0 AND software IS NOT NULL ORDER BY last_blocked ASC")
else:
logger.debug("Fetching records where domains have obfuscated block entries ...")
- database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 1 OR has_obfuscation IS NULL")
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 1 OR has_obfuscation IS NULL ORDER BY last_blocked ASC")
rows = database.cursor.fetchall()
logger.info("Checking %d domains ...", len(rows))