class Provider: address = Address() longCoord = 0.0 latCoord = 0.0 ru = 0.0 #unique radius from provider fu = 0.0 #unique fade [0-1] from provider rd = 0.0 #default radius from resourceType regions = [] #list of pointers to regions impacted by this provider population = [] #list of population constraints _isMobile = False #boolean identifying if the provider offers mobile service def _init_ (self): address = Address() longCoord = 0.0 latCoord = 0.0 ru = 0.0 # unique radius from provider fu = 0.0 # unique fade [0-1] from provider rd = 0.0 #default radius from resourceType regions = [] # list of regions impacted by this provider population = [] # list of population constraints def _init_(self, longCoord, latCoord, radius, fade, defaultRadius, multiplier, regions, population, isMobile, address): self.longCoord = longCoord self.latCoord = latCoord self.ru = radius self.rd = defaultRadius * multiplier #the provider's default radius is the product of resourceType's radius and the resource's multiplier self.fu = fade self.regions = regions self.population = population self.address = address self.isMobile = isMobile
def _init_ (self): address = Address() longCoord = 0.0 latCoord = 0.0 ru = 0.0 # unique radius from provider fu = 0.0 # unique fade [0-1] from provider rd = 0.0 #default radius from resourceType regions = [] # list of regions impacted by this provider population = [] # list of population constraints
def __init__(self, word, address): self.adresses = [] self.word = word try: self.blockId = address.getAddress() // word self.firstAddress = self.blockId * word self.lastAddress = self.firstAddress + word for i in range(self.firstAddress, self.lastAddress): if i == address.getAddress(): self.adresses.append(address) else: self.adresses.append(Address(i)) except TypeError: self.blockId = None self.firstAddress = None self.lastAddress = None
[[1, "Fries(Large)", "Rs.60/-"], [2, "Fries(Small)", "Rs.40/-"]], headers=("Code", "Fries", "MRP"), tablefmt='orgtbl')) f_choice = int(input("Enter your selected Fries's code: ")) f_qty = int( input("How many {}'s do you like to have".format(dict_f[f_choice][0]))) f1 = f.Fries(dict_f[f_choice][0], dict_f[f_choice][1], f_qty) fries_list.append(f1) print("WELCOME TO McDONALDS!!! I 'M LOVIN' IT!!") cid = 14577 name_e = input("Enter your name:\n") no_e = input("{}, Please enter your contact no:\n".format(name_e)) address_e = input("Enter your address:\n").split(',') ad1 = a.Address(address_e[0], address_e[1], address_e[1]) eorc = input("Employee(E) or NOT(N):\n") if eorc == "E" or eorc == "e": print("You're eligible for our special 20% employee discount.\n") eid = 262155 e1 = e.Employee(cid, name_e, no_e, ad1, od1, eid, 20) elif eorc == "C": c1 = c.Customer(cid, name_e, no_e, ad1, od1) loop = True while loop: att = int( input( "What would you like to have?\nPress 1 for Burgers.\nPress 2 for Drinks\nPress 3 for Fries.\n" )) if att == 1:
def __init__(self, fname, lname, street, zip, city, state, contact_number): self._name = name.Name(fname, lname) self._address = addr.Address(street, zip, city, state) self._contact_number = contact_number
def getAddress() -> Address: street = input("Street: ") city = input("City: ") state = input("State: ") zipcode = input("Zip: ") return Address(street, city, state, zipcode)
def __init__(self, *_floor_plans): self.propertyId = 1 self.propertyName = "Nashville Place" self.description = "Regions and We Work Building" self.floorPlans = _floor_plans self.address = Address()
def main(args): try: if args[1] == "-h" or args[1]=="--help": print("Use: ' python3 Creator.py path_to_pcap_file path_to_save_mud_file [ip_addr] ' ") return c = pyshark.FileCapture(args[1],display_filter='tcp || udp',keep_packets=False) save_path = args[2] except FileNotFoundError: print("Incorrect/invalid path for pcap file.") return except: print("Use: ' python3 Creator.py path_to_pcap_file path_to_save_mud_file [ip_addr] ' ") return date_and_time = datetime.now() resolver = dns.resolver.Resolver() hostname = socket.gethostname() if args.__len__()==4: IP = args[3] hostname = args[3] else: IP = socket.gethostbyname(hostname) mud_path = save_path+"/"+hostname+"("+date_and_time.__str__()+")MUD.json" try: mud_file = open(mud_path,'x') except: print("Incorrect/invalid path for MUD file.") return received = AddressTree() sent = AddressTree() for p in c: if p.ip.src == IP: new_addr=Address(p.ip.dst,p[p.transport_layer].dstport,p.transport_layer) sent.add(new_addr) elif p.ip.dst == IP: new_addr=Address(p.ip.src,p[p.transport_layer].dstport,p.transport_layer) received.add(new_addr) remote_to_local_addresslist = received.getAddresses() local_to_remote_addresslist = sent.getAddresses() resolved_rtl = [] unresolved_rtl = [] resolved_ltr = [] unresolved_ltr = [] for add in local_to_remote_addresslist: try: ans = (resolver.query(add[0] + ".in-addr.arpa", "PTR")) for r in ans: resolved_ltr.append((r.__str__(),add[1],add[2])) except: unresolved_ltr.append((add[0],add[1],add[2])) for add in remote_to_local_addresslist: try: ans = (resolver.query(add[0] + ".in-addr.arpa", "PTR")) for r in ans: resolved_rtl.append((r.__str__(),add[1],add[2])) except: unresolved_rtl.append((add[0],add[1],add[2])) from_name = "from-ipv4-"+hostname to_name = "to-ipv4-"+hostname lista1 = createACL("from-ipv4-"+hostname,"ipv4-acl-type",resolved_ltr,unresolved_ltr,0) lista2 = createACL("to-ipv4-" + hostname, "ipv4-acl-type", resolved_rtl, unresolved_rtl,1) mud = { "ietf-mud:mud": { "mud-version" : 1, "mud-url": mud_path, "last-update": date_and_time.__str__(), "cache-validity" : 100, "is-supported" : "true", "systeminfo": hostname, "from-device-policy": { "access-lists": { "access-list": [{ "name": from_name }] } }, "to-device-policy": { "access-lists": { "access-list": [{ "name": to_name }] } } }, "ietf-access-control-list:access-lists": { "acl": [ lista1, lista2 ] } } json.dump(mud,mud_file,indent=1)
def convert_arg_to_object(index): stack_address = Address('[esp+%d]' % (index*4)) memory = Memory(stack_address, 4) return memory
from Address import * # from anbar import * base0LAN = Address(host='192.168.5.17', user='******', database='Moozmar') base0LANT = Address(host='192.168.5.17', user='******', database='Topoli')
def __init__(self, name, address_city, address_street, address_number, age): self.name = name self.address = Address(address_city, address_street, address_number) self.age = age
def store_double(self, address, value): self.instruction_count += 1 adr = Address(address, self.block_size, self.set_number) self.ram.set_block(adr, value) self.cache.set_double(adr, value)
def load_double(self, address): self.instruction_count += 1 adr = Address(address, self.block_size, self.set_number) return self.cache.get_double(adr)
def __init__(self, word, address): self.adresses = [] self.word = word try: self.blockId = address.getAddress() // word self.firstAddress = self.blockId * word self.lastAddress = self.firstAddress + word for i in range(self.firstAddress, self.lastAddress): if i == address.getAddress(): self.adresses.append(address) else: self.adresses.append(Address(i)) except TypeError: self.blockId = None self.firstAddress = None self.lastAddress = None def print(self): print("Bloco: " + str(self.blockId)) for i in self.adresses: i.print() def __eq__(self, b): return self.blockId == b.blockId if __name__ == '__main__': block = Block(4, Address(4, 20)) block.print()
def add_address(self, town, zipcode, street, person_id, country): Address.Address().add_address(town, zipcode, street, person_id, country)