Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /proc/thread-self/root/home/ift/52_procpy/park/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : //proc/thread-self/root/home/ift/52_procpy/park/manage.py

import os,sys,re,glob,time,datetime    
from konto.base.konto import Konto


class Manage (object):

#*****************************************************************************************

#   Runs through a list of accounts to perform certain actions

#   in 18_...:  less ../20*/*.kto.html | python3 -m park.manage check_accounts                 update accounts
#   in 18_...:  less ../20*/*.kto.html | python3 -m park.manage check_accounts show | sort     show accounts
#   in 18_...:  less ../20*/*.kto.html | python3 -m park.manage check_accounts 27              apply 3 euro rule
#   in 18_...:  less ../20*/*.kto.html | python3 -m park.manage check_accounts mahn    <today>  [<datum1>-<datum0>|<datum1]]   execute mahnlauf
#   in 18_...:  less ../20*/*.kto.html | python3 -m park.manage check_accounts mahn    <today>  [<datum1>-<datum0>|<datum1]]   execute mahnlauf-dryrun



    def check_accounts (self,*pars):

        if len(pars) > 0:
            rule = pars[0]
        else:
            rule = ""

        kto_done = []

        for zeile in sys.stdin:   #   hier wird die plate gesucht

            m = re.search(r" 10-B12-3696-(\S+)",zeile)
            if not m:
                continue
            konto = m.group(1)
            konto = re.sub(r"(-ST\d+|-RUE|-zahlung)$","",konto)
            if konto in kto_done:
                continue
            kto_done.append(konto)            
            self._update_konto(konto,zeile,*pars)

        try:
            self.summe
            print("x------------------")
            print("y" + "%15.2f"%self.summe)
            print("z------------------")
        except:
            pass

            
#*****************************************************************************************

    def _update_konto (self,konto,zeile,*pars):
    
        subdir = ""

        if os.path.isdir(konto[0]):
            os.chdir(konto[0])
            subdir = subdir + "../"

        if os.path.isdir(konto[0:2]):
            os.chdir(konto[0:2])
            subdir = subdir + "../"

        try:
            os.mkdir(konto)
        except:
            pass
        os.chdir(konto)
        
        if len(pars) > 0:
            rule = pars[0]
            pars = pars[1:]
        else:
            rule = ""

        if rule == "":
            Konto().kto("^10-B12-3696-" + konto)
        elif rule == "27":
            self.rule_3_euro()
        elif rule == "show":
            self._show_balance()
        elif rule == "mahn":
            self._mahnlauf(0,pars)
        elif rule == "dryrun":
            self._mahnlauf(1,pars)
        elif rule == "halter":
            self._halterdaten(zeile,konto,pars)

        if not os.path.isfile(konto + ".kto"):
            os.system("mv *.kto.html " + konto + ".kto.html 2> /dev/null")
        os.chdir("..")
        while len(subdir) > 0:
            os.chdir("..")
            subdir = subdir[0:-3]

#*****************************************************************************************

#    replaces the placeholder in payments by their plate


    def payments (self):

        ktofile = glob.glob("*.kto.html")[0]
        ktotext = open(ktofile).read()

        ktotext1 = ""
        for zeile in ktotext.split("\n"):
            if "10-B22-1699" in zeile or "10-B22-1650" in zeile:
                m = re.search("([A-Za-z]{1,3}) ?[\-\.\: ] ?([A-Za-z]{1,2}) ?[\-\. ]? ?(\d+)",zeile)
                if m:
                    zeile = re.sub(r" 10-B22-16(50|99) "," 10-B12-3696-"+m.group(1).lower()+"-"+m.group(2).lower()+m.group(3).lower() + "-zahlung ",zeile)
            ktotext1 = ktotext1 + zeile + "\n"

        open(ktofile,"w").write(ktotext1)

#*****************************************************************************************

#   calculates penalties and enters them into the accounting


    def penalty (self):


        names = {  "bmb"         :  "Bad Marienberg (BMBAT)",
                   "baumgarten"  :  "Baumgarten (BGLBG)",
                   "doebeln"     :  "Döbeln (DOEBN)",
                   "goeppingen"  :  "Göppingen Hauptstr. 59 (GPH59)",



                   "bmb_tbroecking"          :   "Thomas Bröcking",
                   "bmb_kkaya"               :   "Kader Kaya",
                   "baumgarten_sepp"         :   "Josef Posch",
                   "doebeln_winkler"         :   "Sascha Winkler",
                   "goeppingen_schellberg"   :   "Michael Schellberg",
                   "goeppingen_bruckmueller" :   "Thomas Bruckmueller",
                   
                }


        betrag = "30.00"


        text      = open(glob.glob("*.kto.html")[0]).read().split("\n")
        m         = re.search(r"^\.?\^?(\S+?)(|.\d\d[0123456789ABC]?) ",text[0])
        ukto      = m.group(1)

        ktotext   = []
        for zeile in text:
            if "STR-BRT" in zeile and not "Ruecknahme" in zeile and not "manuell" in zeile:
                continue
            ktotext.append(zeile)
        
        start_dir = "../12park/"
        month     = ""
        if len(m.group(2)) > 0:
            if len(m.group(2)) > 3:
                month = "0" + m.group(2)[3]
                if month in ("0A","0B","0C"):
                    month = {"0A":"10","0B":"11","0A":"12"}[month]
            month = m.group(2)[1:3] + month


#        kto_dir   = "/home/cgabriel/21_finance/33/ift/70_12park"

        print("ZEITRAUM",month)

        files_to_process = ( glob.glob(start_dir + "/"+month+"*") + 
                             glob.glob(start_dir + "/*/"+month+"*") +
                             glob.glob(start_dir + "/*/*/"+month+"*") +
                             glob.glob(start_dir + "/*/*/*/"+month+"*") +
                             glob.glob(start_dir + "/*/*/*/*/"+month+"*") + 
                             glob.glob(start_dir + "/*/*/*/*/*/"+month+"*") + 
                             glob.glob(start_dir + "/*/*/*/*/*/*/"+month+"*") )
                          
        files_to_process.sort()

#        ktofile = glob.glob(kto_dir+"/*.kto.html")
#        entries = []
#        for zeile in ktofile.split("\n"):
#            if zeile[0:4] == month:
#                entries.append(zeile)

        unique_zeile = []  #  nicht mehr als ein Eintrag pro Datum und Kennzeichen

        for file in files_to_process:

#            print(file)
            if "storniert" in file:
                continue

            m = re.search(r".*?12park[\\\/](.*?)[\\\/](.*?)[\\\/](.*)\.jpg",file)
            if m:
                parkplatz = m.group(1)
                zeuge     = m.group(2)
                vorfall   = m.group(3)
            else:
                continue

#            print(parkplatz,zeuge,vorfall)
            
            m = re.search(r"(\d\d\d\d\d\d).*(\d\d\d\d\d\d)",vorfall)
            if m:
                datum = m.group(1)
                zeit  = m.group(2)
            else:
                continue
                
            m = re.search("([A-Za-zäöü]{1,3})[\-\.\\_: ]([A-Za-zäöü]{1,2})[\-\.\_ ]?(\d+)",vorfall)
            if m:
                kennzeichen = m.group(1).lower() + "-"+m.group(2).lower() + m.group(3)
            else:
                continue

            zeile = "20" + datum + "  -" + betrag + "  10-B11-1374-" + parkplatz + "-STR-BRT  10-B12-3696-" + kennzeichen + "-ST1   0.00  "
            zeile = zeile + "Vertragsstrafe " + names[parkplatz] + " " + zeit[0:2] + ":" + zeit[2:4] + ", Zeuge: "
            zeile = zeile + names[zeuge]

            id    = "20" + datum + kennzeichen

            if not id in unique_zeile:
                ktotext.append(zeile)
                unique_zeile.append(id)

        open(glob.glob("*.kto.html")[0],"w").write("\n".join(ktotext)+"\n")
        os.system("mv *.kto.html vertragsstrafen_" + month + ".kto.html 2> /dev/null")


#*****************************************************************************************

#   reduces the penalty by 27 euro if a payment of 3 euro is recognized

    def rule_3_euro (self):
    
        text = open(glob.glob("*.kto.html")[0]).read()

        standort = "xxx"
        m = re.search(r"-4610-([a-z]+) ",text)
        if m:
            standort = m.group(1)

        
        m = re.search("\n(\d\d\d\d\d\d\d\d) +\-3.00 +(\S+) ",text,re.DOTALL)
        if m:
            datum = m.group(1)
            kto   = m.group(2)
            m1    = re.search(datum + " +\-27.00 ",text)
            if not m1:
                text = text + "\n" + datum + "  -27.00  " + re.sub("-zahlung","-reduce",kto) + "  13-D7f-6611-" + standort + "  0.00  Ermaessigung" + "\n"
                open(glob.glob("*.kto.html")[0],"w").write(text)
                Konto().kto()
                
#*****************************************************************************************


#   in 30_...:  less ../20*/*.kto | python3 -m park.manage show | sort


    def _show_balance (self):
    
        text = open(glob.glob("*.kto.html")[0]).read()
        m = re.search("^(\S+) +(\S+) +(\S+)",text)
        if m:
            konto  = m.group(1)
            betrag = - float(m.group(3))
            
            try:
                self.summe = self.summe + betrag
            except:
                self.summe = betrag
            
            marker = "POS  "
            if betrag > 0.0001:
                marker = "%05u"%(100000-betrag+0.000001)
            elif betrag < 0.0001:
                if betrag > -0.0001:
                    marker = "NULL "
                else:
                    marker = "POS  "
            
            print(marker + ("%11.2f"%(betrag+0.00001)) + "  " + ("%-20s"%m.group(1)),flush=True)

#*****************************************************************************************

    def _mahnlauf (self,dryrun,pars):


#        print(dryrun,pars)

        if len(pars) == 0:
            return()
        else:
            today = pars[0]
            
        if len(pars) > 1:
            datum = pars[1]
        else:
            datum = today

    
        text    = open(glob.glob("*.kto.html")[0]).read()
        zeilen  = text.split("\n")
        zeilen1 = []
        
        m = re.search(r"^(\d\d\d\d\d\d)\-(\d\d\d\d\d\d)$",datum)
        if m:
            datum0 = "20" + m.group(1)
            datum1 = "20" + m.group(2)
        else:
            datum0 = "00000000"
            datum1 = "20" + datum
            
        today = "20" + today
        mahnstufe_erhoeht = 0

#        print(text)

        halterfeststellung = 0
        start_zeilen       = 0
        while len(zeilen) > 0:
            zeile = zeilen.pop()    #  die Zeilen werden rueckwaerts durchgegangen ...
            m = re.search(r"^(\d\d\d\d\d\d\d\d +\-?\d+\.\d\d +)(\S+)(\S)( +\S+-)(\S+)( +\-?\d+\.\d\d)( +.*?)$",zeile)
            if m:
                start_zeilen = 1
                ktoa         = m.group(2)
                mahnstufe    = m.group(3)
                if int(today[0:6]) - int(m.group(1)[0:6]) > 1:  #  die Vertragsstrafe muss mindestens einen Monat zurueckliegen,
                    mahnstufe_erhoeht = 1                       #  damit die Mahnstufe erhoeht wird
                    if mahnstufe in "123456789":
                        mahnstufe = min(int(mahnstufe)+1,9)
                parkplatz    = m.group(5)
                saldo        = m.group(6)
                if float(saldo) > -0.000001:  #   ...  bis man zu einem mindestens ausgelichenen Saldo kommt ...
                    break
                zeilen1.append(m.group(1) + ktoa + str(mahnstufe) + m.group(4) + parkplatz + saldo + m.group(7))
                
                if "12-halter" in zeile:    #  Halterfeststellung schon durchgeführt
                    halterfeststellung = 1

                if "12-mahn" in zeile:
                    datum_letzte_mahnung = m.group(1)[0:8]
                    if int(today[0:6]) - int(datum_letzte_mahnung[0:6]) < 1:
                        return
                
            elif start_zeilen == 1:   #  ... oder keine Buchungszeilen mehr gefunden werden.
                zeilen.append(zeile)
                saldo = "    0.00"
                break
                    
        if len(zeilen1) == 0:  # Konto ist nicht negativ, keine Mahnung schreiben
            return()
            
        if mahnstufe_erhoeht == 0:   #  Mahnung jetzt nicht noetig
            return()

        if zeilen1[-1][0:8] < datum0 or datum1 < zeilen1[-1][0:8]:  #  wenn die erste Vertragsstrafe nicht in dem angegebenen Intervall liegt
            return()

        zeilen1.append(today + "  -3.00  " + ktoa + "1  12-mahn-" + parkplatz + "  0.00  Mahngebuehr Schreiben")
        zeilen1.append(today + "  -0.95  " + ktoa + "1  12-porto-" + parkplatz + "  0.00  Briefkosten Schreiben")
        if halterfeststellung == 0:
            zeilen1.append(today + "  -5.90  " + ktoa + "1  12-halter-" + parkplatz + "  0.00  Halterfeststellung")
            
        zeilen = zeilen + zeilen1
        text1  = "\n".join(zeilen) + "\n"
        
        if dryrun == 0:
            endung = "src"
            print(text1)
            open(glob.glob("*.kto.html")[0],"w").write(text1)
            Konto().kto()
        else:
            endung = "dry"
            self._show_balance()
            print(text1)
                            
        open(today[2:8] + ".mahnschreiben_" + ktoa[:-3] + "." + endung,"w").write( saldo + "\n" + "\n".join(zeilen1)+"\n")

#*****************************************************************************************

    def _halterdaten(self,zeile,konto,pars):

#        print(dryrun,pars)

        m = re.search(r"^(\d\d\d\d)(\d\d)(\d\d) +(\-?\d+\.\d\d) +(\S+) +(\S+) +(\-?\d+\.\d\d) +(.*)",zeile)
        if not m:
            return()
            
        jahr   = m.group(3)
        monat  = m.group(2)
        tag    = m.group(1)
        remark = m.group(8)
        
        m = re.search(r"^.*?\((.*?)\).*?(\d+\:\d\d).*?Zeuge\: +(.*?) *$",remark)
        if not m:
            return()
            
        uhrzeit   = m.group(2)
        parkplatz = m.group(1)
        zeugin    = m.group(3)
        
        kennzeichen = konto.upper()
        kennzeichen = re.sub(r"^(.*[A-Z])(.*)$","\\1 \\2",kennzeichen)

        text = open(glob.glob("*.kto.html")[0]).read()
        m = re.search("^(\S+) +(\S+) +(\S+)",text)
        if m:
            betrag = float(m.group(3))
            if betrag > 1.00:
#                print(betrag)
                print(kennzeichen+","+jahr+"."+monat+"."+tag+","+uhrzeit+","+parkplatz+","+zeugin+",")

#*****************************************************************************************

if __name__ == "__main__":

    Manage.__dict__[sys.argv[1]](Manage(),*sys.argv[2:])

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net