示例#1
0
def handleRecents(site):
    fh.createIfAbsent(masterName)
    fh.createIfAbsent(recentsName)
    masterFile = open(masterName, "r+")
    allMasters = masterFile.read()
    masterFile.close()
    if site not in str(allMasters):
        recentsFile = open(recentsName, "a+")
        masterFile = open(masterName, "a+")
        recentsFile.write(site + "\n")
        masterFile.write(site + "\n")
        recentsFile.close()
        masterFile.close()
    return 0
示例#2
0
def populateInput(name, input, replacement):
    isEmpty = fh.createIfAbsent(input)
    if isEmpty:
        sites = namegen.generateNames(name, replacement)
        sitefile = open(input, "a+")
        for site in sites:
            sitefile.write(site + "\n")
        sitefile.write(
            "If this is the only remaining text, all generated phishing sites have been exhausted."
        )
        sitefile.close()
    return 0
示例#3
0
def certRoutine(valid):
    if debug:
        fh.createIfAbsent(masterName)
        repf = "psdebug.txt"
        master = open("masterlist.txt", "r+")
        rotfsitelist = ["", ""]
        rotfsitelist[0] = master.readline()[:-1]
        rotfsitelist[1] = master.read()
        master.close()
        master = open("masterlist.txt", "w+")
        master.write(rotfsitelist[1])
        master.close()
    else:
        repf = "ps.txt"
    clearFiles(["ps.txt", masterName, recentsName, "time.txt", "psdebug.txt"])
    inprefix = "phsites"
    outprefix = "phcerts"
    inf = inprefix + "-" + re.search(".+\.", valid).group() + "txt"
    outf = outprefix + "-" + re.search(".+\.", valid).group() + "txt"
    populateInput(valid, inf, repf)
    requestAll(inf, outf)
    return 0
示例#4
0
def isItTime(debug):
    fh.createIfAbsent(timename)
    timef = open(timename, "r+")
    contents = timef.read()
    timef.close()
    if len(contents) == 0:
        timef = open(timename, "a+")
        timef.write(str(time.time()))
        timef.close()
        savedTime = time.time()
    else:
        savedTime = int(float(contents))
    if debug:
        interval = halfminute
    else:
        interval = week
    if savedTime + interval <= time.time():
        timef = open(timename, "w+")
        timef.write(str(time.time()))
        timef.close()
        return True
    return False
示例#5
0
def checkWhitelist(phishList, orig):
    whitePrefix = "whitelist"
    whiteName = whitePrefix + "-" + re.search(".+\.", orig).group() + "txt"
    if fh.createIfAbsent(whiteName):
        defaulter = open(whiteName, "w")
        defaulter.write(orig + "\n")
        defaulter.write(re.search(".+\.", orig).group()[:-1] + ".org" + "\n")
        defaulter.close()
    inputfile = open(whiteName, "r")
    toWhite = inputfile.readline()[:-1]
    while len(toWhite) > 0:
        if toWhite in phishList:
            phishList.remove(toWhite)
        toWhite = inputfile.readline()[:-1]
    inputfile.close()
    return 0