root@s:~# python --version
Python 2.7.17
root@s:~# python3 --version
Python 3.6.9
#!/usr/bin/env python3
~# /srv/script.py
Traceback (most recent call last):
File "/srv/script.py", line 14, in <module>
f.write(newlines)
TypeError: write() argument must be str, not list
~# /srv/script.py
Traceback (most recent call last):
File "/srv/script.py", line 5, in <module>
with open(filename, 'r', encoding='utf8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
#!/usr/bin/env python
# coding: utf8
filename = '/srv/www/s.s/www/s-s1.csv' # туты имя файла пишешь
with open(filename, 'w') as f:
lines = f.readlines()
newlines = []
for data in lines:
data = data.split(';')
data[8] = data[8].replace(',', '.')
data = ';'.join(data)
newlines.append(data)
with open(filename, 'w') as f:
f.write(newlines)
~# /srv/script.py
Traceback (most recent call last):
File "/srv/script.py", line 14, in <module>
f.write(newlines)
TypeError: expected a string or other character buffer object
root@steinert:~# /srv/script.py
Traceback (most recent call last):
File "/srv/script.py", line 5, in <module>
with open(filename, 'r', encoding='utf8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
~# /srv/script.py
File "/srv/script.py", line 2
SyntaxError: Non-ASCII character '\xd1' in file /srv/script.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
#!/usr/bin/env python3
filename = '/srv/www/s.s/www/s-s1.csv' # туты имя файла пишешь
with open(filename) as f:
data = f.read().split(';')
data[8] = data[8].replace(',', '.')
data = ';'.join(data)
with open(filename, 'w') as f:
f.write(data)
routel
target gateway source proto scope dev tbl
default link ppp0
default 10.*.*.* static enp2s0
10.*.*.*/ 26 10.*.*.247 kernel link enp2s0
192.168.1.0/ 24 192.168.1.1 kernel linkenxd03745808a81
192.168.2.0/ 24 link wg0
192.168.149.0/ 24 10.*.*.* static enp2s0
1**7 2**2 kernel link ppp0
10.*.*.192 broadcast 10.*.*.247 kernel link enp2s0 local
10.*.1.247 local 10.*.*.247 kernel host enp2s0 local
10.*.*.255 broadcast 10.*.*.247 kernel link enp2s0 local
127.0.0.0 broadcast 127.0.0.1 kernel link lo local
127.0.0.0/ 8 local 127.0.0.1 kernel host lo local
127.0.0.1 local 127.0.0.1 kernel host lo local
127.255.255.255 broadcast 127.0.0.1 kernel link lo local
192.168.1.0 broadcast 192.168.1.1 kernel linkenxd03745808a81 local
192.168.1.1 local 192.168.1.1 kernel hostenxd03745808a81 local
192.168.1.255 broadcast 192.168.1.1 kernel linkenxd03745808a81 local
192.168.2.5 local 192.168.2.5 kernel host wg0 local
2***2 local 2***2 kernel host ppp0 local
::1 kernel lo
fe80::/ 64 kernel enxd03745808a81
fe80::/ 64 kernel enp2s0
::1 local kernel lo local
fe80::***3 local kernel enp2s0 local
fe80::***81 local kernel enxd03745808a81 local
ff00::/ 8 enxd03745808a81 local
ff00::/ 8 enp2s0 local
ff00::/ 8 wg0 local
#
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
#-I POSTROUTING 1 -s 192.168.10.0/24 -o wg+ -j MASQUERADE
#-A POSTROUTING -s 192.168.1.0/24 -o ppp+ -j MASQUERADE
#-A POSTROUTING -s 192.168.10.0/24 -o wg+ -j MASQUERADE
#-A POSTROUTING -o ppp+ -j MASQUERADE
-A POSTROUTING -s 192.168.1.0/24 -o ppp+ -j SNAT --to-source 2***2
COMMIT
*filter
:OUTPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:INPUT DROP [0:0]
#
-A INPUT -i enxd03745808a81 -j ACCEPT
-A INPUT -i enx9cebe8b7431d -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i wg0 -j ACCEPT
# Accept traffic with the ACK flag set
-A INPUT -p tcp -m tcp --tcp-flags ACK ACK -j ACCEPT
# Allow incoming data that is part of a connection we established
-A INPUT -m state --state ESTABLISHED -j ACCEPT
# Allow data that is related to existing connections
-A INPUT -m state --state RELATED -j ACCEPT
# Accept responses to DNS queries
-A INPUT -p udp -m udp --dport 1024:65535 --sport 53 -j ACCEPT
# Accept responses to our pings
-A INPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT
#
-A INPUT -p icmp -m icmp --icmp-type destination-unreachable -j ACCEPT
#
-A INPUT -p icmp -m icmp --icmp-type source-quench -j ACCEPT
#
-A INPUT -p icmp -m icmp --icmp-type time-exceeded -j ACCEPT
#
-A INPUT -p icmp -m icmp --icmp-type parameter-problem -j ACCEPT
-A INPUT -i enp2s0 -j REJECT
-A INPUT -i ppp+ -j REJECT
COMMIT