!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.4.18 (Ubuntu). PHP/7.0.33-0ubuntu0.16.04.16 

uname -a: Linux digifus 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/tmp/junk/csv/   drwxrwxr-x
Free 10.12 GB of 29.4 GB (34.44%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     csv_totalizer.py (1.07 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import sys
import csv 
import os

def usage():
    print " usage: python csv_totalizer.py <directory> | <directory>: directory where the csv files are"

def sumarize_products(filename, products):
    with open(filename) as file:
        reader = csv.reader(file, delimiter=';')
        for line in reader:
            for i in range(0, len(line), 4):
                try:
                    item = line[i]
                    count = int(line[i+1])
                    price = float(line[i+2].replace(".", ""))
                    if item in products.keys():
                        products[item]['count'] += count
                        products[item]['total'] += price*count             
                    else:
                        products[item] = { 'count': count, 'price': price, 'total': price }
                except ValueError:
                    pass

if __name__ == '__main__':
    if len(sys.argv) > 1:
        products = {}
        working_dir = sys.argv[1]
        files =  [ file for file in os.listdir(working_dir) if file.endswith("csv") ]
    for filename in files:
        sumarize_products(filename, products)

    for product, total in products.iteritems():
        print "%s,%0.2f,%0.2f,%0.2f" % (product, total['count'], total['price'], total['total'])
    else:
         usage()

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0081 ]--