Skip to content

Commit

Permalink
Merge pull request #1 from alptugay/development
Browse files Browse the repository at this point in the history
firewallbuilder ile farkli fwbuilder kurulumlari ile farkli firewalla…
  • Loading branch information
volkandod authored Nov 29, 2018
2 parents de3f6b1 + d3c74af commit 56261f3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ahtapot-gdys-gui/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ahtapot-gdys-gui (1.1.2) unstable; urgency=low

* Firewall nesneleri yazilabilir veya sadece okunabilir olmasi icin ozellik eklendi

ahtapot-gdys-gui (1.1.1) unstable; urgency=low

* Initial release (Closes: #1) <0 is the predecessor version number>
Expand Down
36 changes: 36 additions & 0 deletions ahtapot-gdys-gui/var/opt/gdysgui/seteditable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/python
import re
import sys
import os
master_fwb = False
fname="/etc/fw/editable_objects"
if not os.path.isfile(fname):
sys.exit(0)
if os.stat(fname).st_size <= 1:
master_fwb = True

with open(sys.argv[1]) as fwb:
fwb_content = fwb.readlines()

with open(fname) as rw_objects:
rw_object_list = rw_objects.readlines()

rw_object_set = set(map(str.strip, rw_object_list))
new_fwb = []
for line in fwb_content:
if master_fwb:
line = line.replace("ro=\"True\"","ro=\"False\"")
else:
match = re.search(r'\<Firewall.*name=\"(.*?)\".*',line)
if match:
name = match.group(1)
if name not in rw_object_set:
line = line.replace("ro=\"False\"","ro=\"True\"")
else:
line = line.replace("ro=\"True\"","ro=\"False\"")
new_fwb.append(line)

with open(sys.argv[1],'w') as new_fwb_f:
for line in new_fwb:
new_fwb_f.write("%s" % line)

2 changes: 2 additions & 0 deletions ahtapot-gdys-gui/var/opt/gdysgui/start_fw.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def start_fwbuilder(git):
else:
change_file_mod = "chmod 444 " + run_fwb
subprocess.call([change_file_mod],shell=True)
subprocess.Popen(["/var/opt/gdysgui/seteditable.py", run_fwb])

subprocess.Popen(["fwbuilder", "-f",run_fwb])

Expand Down Expand Up @@ -56,6 +57,7 @@ def start_fwbuilder_temp():
cmd_git_check_file = "cd /tmp/" + project_name + " && git checkout "+master_branch+" -- " + file_name
subprocess.call([cmd_git_branch],shell=True)
subprocess.call([cmd_git_check_file],shell=True)
subprocess.Popen(["/var/opt/gdysgui/seteditable.py", run_fwb])

change_file_mod = "chmod 444 " + run_fwb
subprocess.call([change_file_mod],shell=True)
Expand Down

0 comments on commit 56261f3

Please sign in to comment.