Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/sharedra.../domainch...
File: domainchecker.py
#!/opt/imh-python/bin/python3
[0] Fix | Delete
'''
[1] Fix | Delete
Checks domains in /etc/trueuserdomains and looks for obvious
[2] Fix | Delete
fraud or phishing domains on cPanel servers.
[3] Fix | Delete
[4] Fix | Delete
For more documentation, please visit:
[5] Fix | Delete
http://wiki.inmotionhosting.com/index.php?title=Domain_Checker
[6] Fix | Delete
'''
[7] Fix | Delete
[8] Fix | Delete
[9] Fix | Delete
import smtplib
[10] Fix | Delete
import sys
[11] Fix | Delete
import os
[12] Fix | Delete
import re
[13] Fix | Delete
import logging
[14] Fix | Delete
import argparse
[15] Fix | Delete
from pathlib import Path
[16] Fix | Delete
from errno import EACCES
[17] Fix | Delete
from collections import OrderedDict
[18] Fix | Delete
import rads
[19] Fix | Delete
[20] Fix | Delete
__version__ = 'v0.1 Fraud Domain Checker'
[21] Fix | Delete
__author__ = 'RileyL, KolbyH, SeanC, AlexK'
[22] Fix | Delete
[23] Fix | Delete
DEFAULT = {
[24] Fix | Delete
'email_address': 'abuse@inmotionhosting.com',
[25] Fix | Delete
'log_file': '/var/log/domainchecker.log',
[26] Fix | Delete
'badwords_file': '/opt/sharedrads/domainchecker/badwords',
[27] Fix | Delete
'whitelist_file': '.imh/domainchecker.whitelist',
[28] Fix | Delete
'domains_file': '/etc/trueuserdomains',
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
[32] Fix | Delete
class DomainChecker:
[33] Fix | Delete
'''
[34] Fix | Delete
Checks for suspicious domain names on cPanel servers
[35] Fix | Delete
and sends an email notification if any are found.
[36] Fix | Delete
Both the badwords and whitelist are stored in a plain text file.
[37] Fix | Delete
[38] Fix | Delete
Example usage:
[39] Fix | Delete
>>> from domainchecker import DomainChecker
[40] Fix | Delete
>>> checker = DomainChecker(
[41] Fix | Delete
badwords_file='/opt/sharedrads/domainchecker/badwords',
[42] Fix | Delete
whitelist_file='/opt/sharedrads/domainchecker/whitelist',
[43] Fix | Delete
domains_file='/etc/trueuserdomains',
[44] Fix | Delete
email_address='abuse@inmotionhosting.com'
[45] Fix | Delete
logger=rads_logger)
[46] Fix | Delete
>>> checker.run()
[47] Fix | Delete
'''
[48] Fix | Delete
[49] Fix | Delete
def __init__(
[50] Fix | Delete
self,
[51] Fix | Delete
badwords_file: str,
[52] Fix | Delete
whitelist_file: str,
[53] Fix | Delete
domains_file: str,
[54] Fix | Delete
email_address: str,
[55] Fix | Delete
logger: logging.Logger,
[56] Fix | Delete
):
[57] Fix | Delete
'''
[58] Fix | Delete
Load definitions, whitelist, and domains
[59] Fix | Delete
Initialize list for matches
[60] Fix | Delete
[61] Fix | Delete
:param badwords_file: - plain text file of possible phishing terms.
[62] Fix | Delete
:param whitelist_file: - plain text file of known good domains.
[63] Fix | Delete
:param domains_file: - plain text file of domains on the server.
[64] Fix | Delete
:param logger: - logging object to use with functions named:
[65] Fix | Delete
critical() error() warning() info() and debug()
[66] Fix | Delete
'''
[67] Fix | Delete
[68] Fix | Delete
# Get logger object
[69] Fix | Delete
self.logger = logger
[70] Fix | Delete
[71] Fix | Delete
# Get address
[72] Fix | Delete
self.email_address = email_address
[73] Fix | Delete
[74] Fix | Delete
# Load definitions
[75] Fix | Delete
self.definitions = []
[76] Fix | Delete
self.definitions_file = badwords_file
[77] Fix | Delete
self.load_definitions(badwords_file)
[78] Fix | Delete
[79] Fix | Delete
# Load domains
[80] Fix | Delete
self.domains = []
[81] Fix | Delete
self.domains_file = domains_file
[82] Fix | Delete
self.load_domains(domains_file)
[83] Fix | Delete
[84] Fix | Delete
# Load cPanel users in the format: ['userna5', 'example.com']
[85] Fix | Delete
self.users = []
[86] Fix | Delete
self.load_users(domains_file)
[87] Fix | Delete
[88] Fix | Delete
# Load whitelist
[89] Fix | Delete
self.whitelist = []
[90] Fix | Delete
self.whitelist_file = whitelist_file
[91] Fix | Delete
self.load_whitelists(whitelist_file)
[92] Fix | Delete
[93] Fix | Delete
# Remove whitelist domains from domains list
[94] Fix | Delete
for user, domain in self.users:
[95] Fix | Delete
if domain in self.whitelist:
[96] Fix | Delete
self.users.remove([user, domain])
[97] Fix | Delete
[98] Fix | Delete
# Remove whitelist domains from users list
[99] Fix | Delete
for user, domain in self.users:
[100] Fix | Delete
if domain in self.whitelist:
[101] Fix | Delete
self.users.remove([user, domain])
[102] Fix | Delete
print(user, domain)
[103] Fix | Delete
[104] Fix | Delete
# Remove internal usernames and any associated domains
[105] Fix | Delete
for user, domain in self.users:
[106] Fix | Delete
for internal_user in rads.SYS_USERS:
[107] Fix | Delete
if user == internal_user:
[108] Fix | Delete
self.logger.debug(
[109] Fix | Delete
'Removed internal account: ' + user + '/' + domain
[110] Fix | Delete
)
[111] Fix | Delete
self.users.remove([user, domain])
[112] Fix | Delete
self.domains.remove(domain)
[113] Fix | Delete
[114] Fix | Delete
# List of matches found
[115] Fix | Delete
self.matches = []
[116] Fix | Delete
self.match_text = ''
[117] Fix | Delete
[118] Fix | Delete
def load_definitions(self, target_file):
[119] Fix | Delete
'''
[120] Fix | Delete
Returns definitions of possible phishing words from file.
[121] Fix | Delete
[122] Fix | Delete
:param file: File to load definitions from.
[123] Fix | Delete
'''
[124] Fix | Delete
try:
[125] Fix | Delete
with open(target_file, encoding='utf-8') as definitions_file:
[126] Fix | Delete
for line in definitions_file:
[127] Fix | Delete
self.definitions.append(line.strip())
[128] Fix | Delete
except OSError:
[129] Fix | Delete
self.logger.error('Could not open ' + target_file)
[130] Fix | Delete
[131] Fix | Delete
# Remove any blank lines from definitions
[132] Fix | Delete
for line in self.definitions:
[133] Fix | Delete
if line == '':
[134] Fix | Delete
self.definitions.remove(line)
[135] Fix | Delete
[136] Fix | Delete
def load_whitelists(self, target_file: str):
[137] Fix | Delete
'''
[138] Fix | Delete
Returns whitelist domains from files.
[139] Fix | Delete
[140] Fix | Delete
:param file: File to load whitelists from.
[141] Fix | Delete
'''
[142] Fix | Delete
for user, _ in self.users:
[143] Fix | Delete
user_whitelist = Path('/home', user, target_file.lstrip('/'))
[144] Fix | Delete
try:
[145] Fix | Delete
basedir = user_whitelist.parent
[146] Fix | Delete
if not basedir.exists():
[147] Fix | Delete
basedir.mkdir(mode=0o600)
[148] Fix | Delete
os.chown(basedir, 0, 0)
[149] Fix | Delete
user_whitelist.touch(mode=0o600, exist_ok=True)
[150] Fix | Delete
with open(user_whitelist, encoding='utf-8') as whitelist_file:
[151] Fix | Delete
for line in whitelist_file:
[152] Fix | Delete
self.whitelist.append(line.strip())
[153] Fix | Delete
except OSError:
[154] Fix | Delete
self.logger.error('Could not open %s', user_whitelist)
[155] Fix | Delete
[156] Fix | Delete
def load_domains(self, target_file):
[157] Fix | Delete
'''
[158] Fix | Delete
Returns domains on the server as a list.
[159] Fix | Delete
[160] Fix | Delete
:param file: File to load domains on the server.
[161] Fix | Delete
'''
[162] Fix | Delete
domain_pattern = re.compile(r'^(.*):')
[163] Fix | Delete
try:
[164] Fix | Delete
with open(target_file, encoding='utf-8') as domains_file:
[165] Fix | Delete
for line in domains_file:
[166] Fix | Delete
# Strip away domain owner and just get domain
[167] Fix | Delete
domain = domain_pattern.search(line)
[168] Fix | Delete
line = domain.group()[:-1]
[169] Fix | Delete
self.domains.append(line.strip())
[170] Fix | Delete
except OSError:
[171] Fix | Delete
self.logger.error('Could not open %s', target_file)
[172] Fix | Delete
[173] Fix | Delete
def load_users(self, target_file):
[174] Fix | Delete
'''
[175] Fix | Delete
Load cPanel users in the format: ['userna5', 'example.com']
[176] Fix | Delete
[177] Fix | Delete
:param file: File to load domains on the server.
[178] Fix | Delete
'''
[179] Fix | Delete
# regex patterns to get users and domains from trueuserdomains file
[180] Fix | Delete
users_pattern = re.compile(r':(.*)$')
[181] Fix | Delete
domain_pattern = re.compile(r'^(.*):')
[182] Fix | Delete
try:
[183] Fix | Delete
with open(target_file, encoding='utf-8') as domains_file:
[184] Fix | Delete
for line in domains_file:
[185] Fix | Delete
# Get user from line
[186] Fix | Delete
user = users_pattern.search(line)
[187] Fix | Delete
the_user = user.group()[2:]
[188] Fix | Delete
# Get domain from line
[189] Fix | Delete
domain = domain_pattern.search(line)
[190] Fix | Delete
the_domain = domain.group()[:-1]
[191] Fix | Delete
# check if user is cPanel user
[192] Fix | Delete
if rads.is_cpuser(the_user):
[193] Fix | Delete
# add information to self.users
[194] Fix | Delete
owner_info = [the_user, the_domain]
[195] Fix | Delete
self.users.append(owner_info)
[196] Fix | Delete
except OSError:
[197] Fix | Delete
self.logger.error('Could not open %s', target_file)
[198] Fix | Delete
[199] Fix | Delete
def regex_search(self, bad_word, domain):
[200] Fix | Delete
'''
[201] Fix | Delete
Uses the '*' character as "any" (globbing)
[202] Fix | Delete
the following link contains more information on globbing:
[203] Fix | Delete
http://www.tldp.org/LDP/abs/html/globbingref.html
[204] Fix | Delete
[205] Fix | Delete
Searches for string bad_word in string domain
[206] Fix | Delete
if match is found, it's added to self.matches
[207] Fix | Delete
and self.match_text is updated
[208] Fix | Delete
[209] Fix | Delete
:param bad_word: str - bad word to check
[210] Fix | Delete
:param domain: str - domain to check
[211] Fix | Delete
'''
[212] Fix | Delete
# Ensure no whitelisted domains were matched
[213] Fix | Delete
for allowed_domain in self.whitelist:
[214] Fix | Delete
if allowed_domain in domain:
[215] Fix | Delete
return
[216] Fix | Delete
[217] Fix | Delete
# create search string
[218] Fix | Delete
search_string = ''
[219] Fix | Delete
segments = [i for i, ltr in enumerate(bad_word) if ltr == '*']
[220] Fix | Delete
last = 0
[221] Fix | Delete
for next_segment in segments:
[222] Fix | Delete
search_string += bad_word[last:next_segment] + r'(.*)'
[223] Fix | Delete
last = next_segment + 1
[224] Fix | Delete
search_string += bad_word[last : len(bad_word)]
[225] Fix | Delete
search_string = search_string.encode('string-escape')
[226] Fix | Delete
search_pattern = re.compile(search_string)
[227] Fix | Delete
[228] Fix | Delete
# if bad_word found in search for string
[229] Fix | Delete
if search_pattern.search(domain):
[230] Fix | Delete
# if match found, add domain of match found to email
[231] Fix | Delete
self.matches.append(domain)
[232] Fix | Delete
self.match_text += domain + ': '
[233] Fix | Delete
# add cPanel account owner information to email
[234] Fix | Delete
for user, dom in self.users:
[235] Fix | Delete
# if there is a user, add it to the email
[236] Fix | Delete
if dom == domain and rads.is_cpuser(user):
[237] Fix | Delete
self.match_text += user
[238] Fix | Delete
# if not on new line, add new line
[239] Fix | Delete
if not self.match_text.endswith('\n'):
[240] Fix | Delete
self.match_text += '\n'
[241] Fix | Delete
return
[242] Fix | Delete
[243] Fix | Delete
def plaintext_search(self, bad_word, domain):
[244] Fix | Delete
'''
[245] Fix | Delete
searches for string bad_word in string domain
[246] Fix | Delete
if match is found, it's added to self.matches
[247] Fix | Delete
and self.match_text is updated
[248] Fix | Delete
[249] Fix | Delete
:param bad_word: str - bad word to check
[250] Fix | Delete
:param domain: str - domain to check
[251] Fix | Delete
'''
[252] Fix | Delete
if bad_word in domain:
[253] Fix | Delete
# Ensure no whitelisted domains were matched
[254] Fix | Delete
for allowed_domain in self.whitelist:
[255] Fix | Delete
if allowed_domain in domain:
[256] Fix | Delete
return
[257] Fix | Delete
# if match found, add domain of match found to email
[258] Fix | Delete
self.matches.append(domain)
[259] Fix | Delete
self.match_text += domain + ': '
[260] Fix | Delete
# add cPanel account owner information to email
[261] Fix | Delete
for user, dom in self.users:
[262] Fix | Delete
# if there is a user, add it to the email
[263] Fix | Delete
if dom == domain and rads.is_cpuser(user):
[264] Fix | Delete
self.match_text += user
[265] Fix | Delete
if not self.match_text.endswith('\n'):
[266] Fix | Delete
self.match_text += '\n'
[267] Fix | Delete
return
[268] Fix | Delete
[269] Fix | Delete
def run(self):
[270] Fix | Delete
'''
[271] Fix | Delete
Open /etc/trueuserdomains and checks every line from the badwords list.
[272] Fix | Delete
Matches found that are in the whitelist are ignored
[273] Fix | Delete
'''
[274] Fix | Delete
for domain in self.domains:
[275] Fix | Delete
for bad_word in self.definitions:
[276] Fix | Delete
if '*' in bad_word: # If globbing, search with regex.
[277] Fix | Delete
self.regex_search(bad_word, domain)
[278] Fix | Delete
else: # If not globbing, search regularly.
[279] Fix | Delete
self.plaintext_search(bad_word, domain)
[280] Fix | Delete
[281] Fix | Delete
# Remove any duplicates
[282] Fix | Delete
self.matches = list(set(self.matches))
[283] Fix | Delete
[284] Fix | Delete
# Reference: https://stackoverflow.com/questions/28518340
[285] Fix | Delete
self.match_text = '\n'.join(
[286] Fix | Delete
list(OrderedDict.fromkeys(self.match_text.split('\n')))
[287] Fix | Delete
)
[288] Fix | Delete
[289] Fix | Delete
if self.matches:
[290] Fix | Delete
self.send_email()
[291] Fix | Delete
else:
[292] Fix | Delete
self.logger.info('No matches to possible phishing words found.')
[293] Fix | Delete
[294] Fix | Delete
def add_to_whitelist(self, domains):
[295] Fix | Delete
'''
[296] Fix | Delete
Add domains to the whitelist file.
[297] Fix | Delete
[298] Fix | Delete
:param domain: str - Domains to add to the whitelist.
[299] Fix | Delete
'''
[300] Fix | Delete
domain_list = domains.split(' ')
[301] Fix | Delete
for user, user_domain in self.users:
[302] Fix | Delete
if user_domain in domain_list:
[303] Fix | Delete
user_whitelist = '/home/' + user + '/' + self.whitelist_file
[304] Fix | Delete
try:
[305] Fix | Delete
with open(user_whitelist, 'a+', encoding='utf-8') as file:
[306] Fix | Delete
file.write(domains + '\n')
[307] Fix | Delete
except OSError as error:
[308] Fix | Delete
self.logger.error(error)
[309] Fix | Delete
self.logger.info(domains + ' added to whitelist.')
[310] Fix | Delete
[311] Fix | Delete
def send_email(self):
[312] Fix | Delete
'''
[313] Fix | Delete
Email report of possible fraudulent or phishing domains.
[314] Fix | Delete
'''
[315] Fix | Delete
to_addr = self.email_address
[316] Fix | Delete
subject = 'Possible fraudulent or phishing domains found!'
[317] Fix | Delete
body = (
[318] Fix | Delete
'The following domain(s) contain keywords that may be '
[319] Fix | Delete
+ 'fraudulent activity:\n'
[320] Fix | Delete
+ self.match_text[:-1]
[321] Fix | Delete
)
[322] Fix | Delete
self.logger.info('An email will now be sent for review by T2S staff')
[323] Fix | Delete
self.logger.debug(body)
[324] Fix | Delete
try:
[325] Fix | Delete
rads.send_email(to_addr, subject, body, errs=True)
[326] Fix | Delete
except (smtplib.SMTPException, OSError) as exc:
[327] Fix | Delete
self.logger.error(exc)
[328] Fix | Delete
self.logger.error(
[329] Fix | Delete
'Could not send email regarding '
[330] Fix | Delete
'possible phishing domain(s) failed.'
[331] Fix | Delete
)
[332] Fix | Delete
else:
[333] Fix | Delete
self.logger.info('Email sent successfully.')
[334] Fix | Delete
[335] Fix | Delete
[336] Fix | Delete
def accessible(filename, mode):
[337] Fix | Delete
'''
[338] Fix | Delete
Verify access to file
[339] Fix | Delete
[340] Fix | Delete
:param filename: str - name of file to check
[341] Fix | Delete
:param mode: str - mode to test
[342] Fix | Delete
'''
[343] Fix | Delete
try:
[344] Fix | Delete
with open(filename, mode) as _: # pylint: disable=unspecified-encoding
[345] Fix | Delete
pass
[346] Fix | Delete
return True
[347] Fix | Delete
except OSError as error:
[348] Fix | Delete
print(error)
[349] Fix | Delete
return False
[350] Fix | Delete
[351] Fix | Delete
[352] Fix | Delete
def parse_arguments():
[353] Fix | Delete
'''
[354] Fix | Delete
Parse the arguments using argparse
[355] Fix | Delete
'''
[356] Fix | Delete
parser = argparse.ArgumentParser(prog='domainchecker', description=__doc__)
[357] Fix | Delete
parser.add_argument(
[358] Fix | Delete
'-a',
[359] Fix | Delete
'--add-to-whitelist',
[360] Fix | Delete
dest='added_whitelist_domains',
[361] Fix | Delete
default='',
[362] Fix | Delete
help='domain to add to whitelist',
[363] Fix | Delete
)
[364] Fix | Delete
parser.add_argument(
[365] Fix | Delete
'-b',
[366] Fix | Delete
'--badwords',
[367] Fix | Delete
dest='badwords_file',
[368] Fix | Delete
default=DEFAULT['badwords_file'],
[369] Fix | Delete
help='file containing bad words definitions',
[370] Fix | Delete
)
[371] Fix | Delete
parser.add_argument(
[372] Fix | Delete
'-d',
[373] Fix | Delete
'--domains',
[374] Fix | Delete
dest='domains_file',
[375] Fix | Delete
default=DEFAULT['domains_file'],
[376] Fix | Delete
help='file containing list of domains to check',
[377] Fix | Delete
)
[378] Fix | Delete
parser.add_argument(
[379] Fix | Delete
'-e',
[380] Fix | Delete
'--email-address',
[381] Fix | Delete
dest='email_address',
[382] Fix | Delete
default=DEFAULT['email_address'],
[383] Fix | Delete
help='domain to add to whitelist',
[384] Fix | Delete
)
[385] Fix | Delete
parser.add_argument(
[386] Fix | Delete
'-l',
[387] Fix | Delete
'--loglevel',
[388] Fix | Delete
dest='loglevel',
[389] Fix | Delete
default='info',
[390] Fix | Delete
choices=['critical', 'error', 'warning', 'info', 'debug'],
[391] Fix | Delete
help='level of verbosity in logging',
[392] Fix | Delete
)
[393] Fix | Delete
parser.add_argument(
[394] Fix | Delete
'-o',
[395] Fix | Delete
'--output',
[396] Fix | Delete
dest='log_file',
[397] Fix | Delete
default=DEFAULT['log_file'],
[398] Fix | Delete
help='file to send logs to',
[399] Fix | Delete
)
[400] Fix | Delete
parser.add_argument(
[401] Fix | Delete
'-v',
[402] Fix | Delete
'--verbose',
[403] Fix | Delete
dest='verbose',
[404] Fix | Delete
default=False,
[405] Fix | Delete
action='store_true',
[406] Fix | Delete
help='output logs to command line',
[407] Fix | Delete
)
[408] Fix | Delete
parser.add_argument(
[409] Fix | Delete
'-w',
[410] Fix | Delete
'--whitelist',
[411] Fix | Delete
dest='whitelist_file',
[412] Fix | Delete
default=DEFAULT['whitelist_file'],
[413] Fix | Delete
help='file containing whitelisted domains',
[414] Fix | Delete
)
[415] Fix | Delete
[416] Fix | Delete
args = parser.parse_args() # Parse arguments
[417] Fix | Delete
[418] Fix | Delete
if args.verbose: # Set CLI output to std if verbose
[419] Fix | Delete
args.output = sys.stderr
[420] Fix | Delete
else:
[421] Fix | Delete
args.output = None
[422] Fix | Delete
[423] Fix | Delete
# Set logging value from optional argment
[424] Fix | Delete
if args.loglevel == 'critical':
[425] Fix | Delete
args.loglevel = logging.CRITICAL
[426] Fix | Delete
elif args.loglevel == 'error':
[427] Fix | Delete
args.loglevel = logging.ERROR
[428] Fix | Delete
elif args.loglevel == 'warning':
[429] Fix | Delete
args.loglevel = logging.WARNING
[430] Fix | Delete
elif args.loglevel == 'info':
[431] Fix | Delete
args.loglevel = logging.INFO
[432] Fix | Delete
elif args.loglevel == 'debug':
[433] Fix | Delete
args.loglevel = logging.DEBUG
[434] Fix | Delete
else: # Logging set to INFO by default.
[435] Fix | Delete
args.loglevel = logging.INFO
[436] Fix | Delete
[437] Fix | Delete
# Verify access to files
[438] Fix | Delete
files = [
[439] Fix | Delete
(args.log_file, 'a+'),
[440] Fix | Delete
(args.badwords_file, 'r'),
[441] Fix | Delete
(args.domains_file, 'r'),
[442] Fix | Delete
]
[443] Fix | Delete
[444] Fix | Delete
for _file_, mode in files:
[445] Fix | Delete
if not accessible(_file_, mode):
[446] Fix | Delete
sys.exit(EACCES)
[447] Fix | Delete
[448] Fix | Delete
return args
[449] Fix | Delete
[450] Fix | Delete
[451] Fix | Delete
def main():
[452] Fix | Delete
'''
[453] Fix | Delete
usage: domainchecker [-h] [-a ADDED_WHITELIST_DOMAINS] [-b BADWORDS_FILE]
[454] Fix | Delete
[-d DOMAINS_FILE] [-e EMAIL_ADDRESS]
[455] Fix | Delete
[-l {critical,error,warning,info,debug}] [-o LOG_FILE]
[456] Fix | Delete
[-v] [-w WHITELIST_FILE]
[457] Fix | Delete
[458] Fix | Delete
Checks domains in /etc/trueuserdomains and looks for obvious
[459] Fix | Delete
fraud or phishing domains on cPanel servers.
[460] Fix | Delete
[461] Fix | Delete
For more documentation, please visit:
[462] Fix | Delete
http://wiki.inmotionhosting.com/index.php?title=Domain_Checker
[463] Fix | Delete
[464] Fix | Delete
optional arguments:
[465] Fix | Delete
-h, --help show this help message and exit
[466] Fix | Delete
-a ADDED_WHITELIST_DOMAINS, --add-to-whitelist ADDED_WHITELIST_DOMAINS
[467] Fix | Delete
domain to add to whitelist
[468] Fix | Delete
-b BADWORDS_FILE, --badwords BADWORDS_FILE
[469] Fix | Delete
file containing bad words definitions
[470] Fix | Delete
-d DOMAINS_FILE, --domains DOMAINS_FILE
[471] Fix | Delete
file containing list of domains to check
[472] Fix | Delete
-e EMAIL_ADDRESS, --email-address EMAIL_ADDRESS
[473] Fix | Delete
domain to add to whitelist
[474] Fix | Delete
-l {critical,error,warning,info,debug}, --loglevel
[475] Fix | Delete
level of verbosity in logging
[476] Fix | Delete
-o LOG_FILE, --output LOG_FILE
[477] Fix | Delete
file to send logs to
[478] Fix | Delete
-v, --verbose output logs to command line
[479] Fix | Delete
-w WHITELIST_FILE, --whitelist WHITELIST_FILE
[480] Fix | Delete
file containing whitelisted domains
[481] Fix | Delete
'''
[482] Fix | Delete
# parse arguments
[483] Fix | Delete
args = parse_arguments()
[484] Fix | Delete
[485] Fix | Delete
# set up logging
[486] Fix | Delete
rads_logger = rads.setup_logging(
[487] Fix | Delete
path=args.log_file,
[488] Fix | Delete
name='domainchecker',
[489] Fix | Delete
loglevel=args.loglevel,
[490] Fix | Delete
print_out=args.output,
[491] Fix | Delete
)
[492] Fix | Delete
[493] Fix | Delete
# run domain checker
[494] Fix | Delete
checker = DomainChecker(
[495] Fix | Delete
badwords_file=args.badwords_file,
[496] Fix | Delete
whitelist_file=args.whitelist_file,
[497] Fix | Delete
domains_file=args.domains_file,
[498] Fix | Delete
email_address=args.email_address,
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function