Database: Check all tables from a known owner

This is an oracle 12c query to find out all tables that are owned by “cyrus”.

select owner,table_name from all_tables where owner='CYRUS';

the contents in the row is case sensitive, in this example the content in row “owner” is CYRUS not Cyrus or cyrus.

another way if you do not know the case of the content use this:

select owner,table_name from all_tables where upper(owner)=upper('cyrus');

another way is to convert the owner name to lower case

select owner,table_name from all_tables where lower(owner)='cyrus';

Posted in Database | Tagged , | Leave a comment

ICT research method – what is ICT research

What is research
Research is a creation of new knowledge.

Research outcomes

  • A new and improved product
  • A deeper understanding of a research topic
  • A new or improved model and theory to compliment existing research
  • A new or improved technique to solve certain research problems.

Aims of research

  • Observe and describe a research problem
  • Predict
  • Identify the cause of a problem
  • To explain a research problem

What is ICT research
It is the creation of new knowledge in any ICT areas.

  • New and more efficient routing protocol
  • How to better secure gratuitous ARP used in virtual router routing protocol

What is research project
Project is a sequence of activities/tasks to create new knowledge within specific timeline, within budget, according to specification and with resources.

Phases of research
The following in sequence:

  • Literature review
  • Define research question/problem
  • Research design
  • Collect data
  • Data analysis
  • Report finding

Research approaches

  • Survey – research data collected from population of interest
  • Design and creation – research focus on developing new ICT product
  • Experiment – research to find causal relationship between selected variables
  • Action research = research focus to address practical issues
  • Case study research – research focus on one or more instances of things of interest (case)
Posted in ICT research method | Leave a comment

[tufin]adding generic routes

Tufin securetrack is incapable of detecting routes that use policy based routing, a possible solution to include routes of policy based routing is to add generic routes. This can be found in this

you need to create a csv file in tufin ST, then use the <code>/usr/local/st/topology_generic_routes -m 5 -i your_file_in.csv</code>

update the topology with the generic network, this is quicker than pressing the synchronize button in the network gui in Tufin ST.


To check if generic network is added to the firewall, eg if firewall id is 5.
<code>/usr/local/st/topology_generic_routes -m 5 -p</code>

Has to be version 17.3 onwards, anything earlier than this does not have this script.

Posted in General stuffs | Tagged , | Leave a comment

[python]Comparing missing ip addresses between original inventory with object group

An inventory list is kept to record hostnames and ip addresses, this inventory list (inventory.xlsx) is currently maintained by automation.

For every virtual machine created, the hostname and its corresponding ip address are recorded in the list, automation will update the ip address into the existing object group in the firewall.

However there is a report that there are certain ip addresses not included in the interesting_group, you need to write a script to leverage Tufin SecureTrack to find out what are the missing ip addresses in the existing group as compared with the inventory list.

In the inventory list there are ip addresses which belong to subnet, this whole subnet is not the network protected by firewall hence skip during collection.

The script needs to be cautious to skip recording items from interesting_group.

This is a code written in haste, hence not structured, there are repeated items which worth to create functions.

import xml.etree.ElementTree as ET
import requests
from openpyxl import load_workbook
from netaddr import IPNetwork, IPAddress

NSMAP = {'xsi': ''}
tufin_st_xml = requests.session()
tufin_st_xml.verify = False
tufin_st_xml.headers.update({'Content-type': 'application/xml'})
tufin_st_xml.auth = requests.auth.HTTPBasicAuth('admin', 'password')

ip_collections = []
group_collections = []
base_list = []
row = 2
column = 7
ip_from_inventory = []
filtered_ip = []
filtered_ip_collections = []
missing_ip = []
    response = tufin_st_xml.get('https://secure_track_address/securetrack/api/devices/1/network_objects?type=group&show_members=true&name=interesting_group')
    xml_response = ET.fromstring(response.text)
    for xml_item in xml_response.findall('.//ip'):
    for xml_type in xml_response.findall("./network_object[@xsi:type='networkObjectGroupDTO']", NSMAP):
        if 'interesting_group' not in xml_type.find('display_name').text:
except Exception as e:

if group_collections:
    for group in group_collections:
            response = tufin_st_xml.get('https://secure_track_address/securetrack/api/devices/1/network_objects?type=group&show_members=true&name={}'.format(group))
            xml_response = ET.fromstring(response.text)
            for xml_item in xml_response.findall('.//ip'):
        except Exception as e:

for ip_item in ip_collections:
    if IPAddress(ip_item) not in IPNetwork('').iter_hosts():
wb = load_workbook('inventory.xlsx')
while wb['Sheet1'].cell(row, column).value is not None:
    ip_from_inventory.append(wb['Sheet1'].cell(row, column).value)
    row += 1

for ip_item in ip_from_inventory:
    if IPAddress(ip_item) not in IPNetwork('').iter_hosts():

missing_ip = set(filtered_ip).difference(filtered_ip_collections)
Posted in Python, Scripting | Tagged , , , , , | Leave a comment

[python]Excluding ip addresses belonging a subnet

suppose if you need to enumerate ip addresses from a list, but want to exclude ip addresses belonging to a subnet here’s a solution which you can do with netaddr module.
Supposed ip_from_inventory is the list of ip addresses you have obtained from a file.

from netaddr import IPNetwork, IPAddress
for ip_item in ip_from_inventory:
    if IPAddress(ip_item) not in IPNetwork('').iter_hosts():

This example exclude ip address that belongs to, and will list other ip addresses that are not.

Posted in Python, Scripting | Tagged , | Leave a comment

[python]Writing to temporary file

Supposed you have collected a list item known as ip_collections, and you want to write the list to a temp file.

import tempfile
with tempfile.TemporaryFile() as tf:
    for ip in ip_collections:
        tf.write(bytes(ip + '\n', 'utf-8'))

Need to convert the string in byte, the is to re-wind the pointer back to the start of the file.

After the code exits the with context the temp file is removed.

Supposed you want to store the values of temp file into a variable for some other purpose before removal.

import tempfile
base_list = []
with tempfile.TemporaryFile() as tf:
    for ip in ip_collections:
        tf.write(bytes(ip + '\n', 'utf-8'))
    base_list =


Need to rewind the start of file with so that all items in the temp file will be transferred to base_list. Need to take note that has to be put outside for loop otherwise the values will be overwritten on each iteration.
the print statement is for testing if the list is stored.

Posted in Python, Scripting | Tagged , | Leave a comment

[python]DNS resolution webapp with flask

Very simple webapp, I still need to do some styling with CSS… this is a simple concept.
here’s an example:
Screen Shot 2018-05-20 at 11.11.59 PM

The output will be:
Screen Shot 2018-05-20 at 11.12.55 PM

Here are the jinja2 templates:
Screen Shot 2018-05-20 at 11.13.42 PM.png

Here’s the code.

from flask import Flask, request, render_template
import socket

def host_processing(host):
    answer = ""
        answer = socket.gethostbyname(host)
    except Exception:
        # If not resolvable, dun care.

    if answer:
        return answer
        return host

app = Flask(__name__)

def main_form():
    return render_template('tool.html')

@app.route('/', methods=['POST'])
def post_form():
    answers = []
    hosts = request.form['text'].split(',')
    for host in hosts:
    return render_template('answers.html', answers=answers)

if __name__ == '__main__':
Posted in Python, Scripting | Tagged , , | 2 Comments