Files
OpenVPN-Monitoring-Simple/APP/__pycache__/db.cpython-314.pyc

45 lines
5.1 KiB
Plaintext
Raw Normal View History

2026-01-09 01:05:50 +03:00
+
a`i<> <00><00>:<00>^RIt^RIt^RIt^RIt!RR4tR#)<04>Nc<00><a<00>]tRt^toRRltRtRtRtRtVt R#)<08>DatabaseManagerc<08><><00>Wn\P!4Vn\P
!\ 4VnVP4R#)N) <09> config_file<6C> configparser<65> ConfigParser<65>config<69>logging<6E> getLogger<65>__name__<5F>logger<65> load_config)<02>selfrs&&<26> APP/db.py<70>__init__<5F>DatabaseManager.__init__s6<00><00>&<26><18>"<22>/<2F>/<2F>1<><04> <0B><1D>'<27>'<27><08>1<><04> <0B> <0C><18><18><1A>c<08><><00>\PPVP4'd&VPP VP4VPP RRRR7VnR#)<05>openvpn_monitor<6F>db_pathzopenvpn_monitor.db)<01>fallbackN)<08>os<6F>path<74>existsrr <00>read<61>getr<00>rs&rr<00>DatabaseManager.load_config sO<00><00> <0A>7<EFBFBD>7<EFBFBD>><3E>><3E>$<24>*<2A>*<2A> +<2B> +<2B> <10>K<EFBFBD>K<EFBFBD> <1C> <1C>T<EFBFBD>-<2D>-<2D> .<2E><1B>{<7B>{<7B><EFBFBD><EFBFBD>'8<>)<29>Nb<4E><EFBFBD>c<><04> rc <0C>B<00>\P!VP4#)zGet a database connection)<03>sqlite3<65>connectrrs&r<00>get_connection<6F>DatabaseManager.get_connections<00><00><16><EFBFBD><EFBFBD>t<EFBFBD>|<7C>|<7C>,<2C>,rc <0C>|<00>\PPVP4pV'd=\PP V4'g\P
!V4VPPRVP 24VP4pVP4pVPR4VPR4VPR4.R OpVF0pVPRV R24VPRV RV R 24K2 VP4VPPR
4VP4R # \ dELi;i \d)pTPPR T 24R p?LRR p?ii;i TP4i;i)zInitialize the database schemazUsing database: a<>
CREATE TABLE IF NOT EXISTS clients (
id INTEGER PRIMARY KEY AUTOINCREMENT,
common_name TEXT UNIQUE NOT NULL,
real_address TEXT,
status TEXT DEFAULT 'Active',
total_bytes_received INTEGER DEFAULT 0,
total_bytes_sent INTEGER DEFAULT 0,
last_bytes_received INTEGER DEFAULT 0,
last_bytes_sent INTEGER DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_activity TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
a<>
CREATE TABLE IF NOT EXISTS usage_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
client_id INTEGER,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
bytes_received INTEGER,
bytes_sent INTEGER,
bytes_received_rate_mbps REAL,
bytes_sent_rate_mbps REAL,
FOREIGN KEY (client_id) REFERENCES clients (id)
)
zCCREATE INDEX IF NOT EXISTS idx_usage_ts ON usage_history(timestamp)z,
CREATE TABLE IF NOT EXISTS af (
timestamp TEXT NOT NULL,
client_id INTEGER NOT NULL,
bytes_received INTEGER DEFAULT 0,
bytes_sent INTEGER DEFAULT 0,
PRIMARY KEY (timestamp, client_id),
FOREIGN KEY (client_id) REFERENCES clients (id)
)
zCREATE INDEX IF NOT EXISTS idx_z_ts ON z (timestamp)z%Database initialized with full schemazDatabase initialization error: N)<05>
stats_5min<EFBFBD> stats_15min<69> stats_hourly<6C>stats_6h<36> stats_daily)rr<00>dirnamerr<00>makedirs<72>OSErrorr <00>infor"<00>cursor<6F>execute<74>commit<69> Exception<6F>error<6F>close)r<00>db_dir<69>connr.<00>tables<65>table<6C>es& r<00> init_database<73>DatabaseManager.init_databases}<00><00><14><17><17><1F><1F><14><1C><1C>.<2E><06> <11>"<22>'<27>'<27>.<2E>.<2E><16>0<>0<> <15><12> <0B> <0B>F<EFBFBD>#<23> <0A> <0B> <0B><18><18>+<2B>D<EFBFBD>L<EFBFBD>L<EFBFBD>><3E>:<3A>;<3B><13>"<22>"<22>$<24><04><15><1B><1B><1D><06>6 <19> <12>N<EFBFBD>N<EFBFBD><10> <11>" <13>N<EFBFBD>N<EFBFBD> <10> <11> <13>N<EFBFBD>N<EFBFBD>`<60> a<>^<01>F<EFBFBD><1F><05><16><0E><0E>$,<2C>,1<>7<EFBFBD>3<11> <14> <15><17><0E><0E>!@<40><15><07>w<EFBFBD>u<EFBFBD>g<EFBFBD>U`<60>a<>b<> <20> <11>K<EFBFBD>K<EFBFBD>M<EFBFBD> <10>K<EFBFBD>K<EFBFBD> <1C> <1C>D<> E<> <11>J<EFBFBD>J<EFBFBD>L<EFBFBD><4C>}<1B> <15><14> <15><>v<19> E<01> <10>K<EFBFBD>K<EFBFBD> <1D> <1D> ?<3F><01>s<EFBFBD>C<> D<> D<><44> E<01><> <11>J<EFBFBD>J<EFBFBD>L<EFBFBD>s=<00>E!<00>7BE3<00>! E0<03>/E0<03>3 F&<03>>F!<03>F)<00>!F&<03>&F)<00>)F;)r rrr N)z
config.ini)
r <00>
__module__<EFBFBD> __qualname__<5F>__firstlineno__rrr"r9<00>__static_attributes__<5F>__classdictcell__)<01> __classdict__s@rrrs!<00><><00><00><1B> d<01>
-<2D>E<19>Err)r rrr
r<00>rr<00><module>rBs<00><01><0E><13> <09><0E>U<19>Ur