예제 #1
0
def getSourceInterfaceForHost(ssh, sourceIP):
	# Loop once only in case initial source isn't in ASA routing table, then search for default route
	for k in range(2):
		# Command to check for interface source would originate from
		command = "show route %s | inc via" % (sourceIP)
		# Get result of above command when run on the firewall
		result = nfn.runSSHCommandInSession(command, ssh)

		# This is blank if it isn't in the routing table; AKA check for default route next
		if fn.isEmpty(result):
			sourceIP = "0.0.0.0"
			continue
		else:
			break

	# Split returned results by line
	result = result.split("\n")
	# Store last line of list into a new string variable
	resultStr = result[-1]
	# Reduce all spacing to just a single space per section
	resultStr = fn.replaceDoubleSpaces(resultStr)
	# Split string by spaces.  We are looking for the last field
	resultList = resultStr.split(" ")
	# Return interface name
	return resultList[-1]
예제 #2
0
 def testMyFxn(self):
     self.assertTrue(functions.isEmpty([]))
     self.assertFalse(functions.isEmpty([1, 2]))
예제 #3
0
    func.creatinMenu();
    escolhamenu=input("key ur option.. ");
    system("clear");




  if escolhamenu == "1":
    while(resp=="s"):
      i=0;
      system("clear");
      #client
      print(func.message(c1));
      c1.attrName.sort();
      for i in range(len(c1.attrName)):
        while(func.isEmpty(c1.attributes[i])==True or func.isSpecialChar(c1.attributes[i])==True):
          c1.attributes[i]=input(c1.attrName[i]+": ");
      system("clear")
    
    
    
      #service
      print(func.message(s1));
      s1.attrName.sort();
      for i in range(len(s1.attrName)):
        if i==0 or i==1:
          s1.attributes[i]="date";
          while(func.isdate(s1.attributes[i])==False):
            s1.attributes[i]=input(s1.attrName[i]+": ");#isdate
        elif(i==2):
          s1.attributes[i]="true";
예제 #4
0
print()

turn = True

while functions.isGameOver(board) == -1:
    if turn:
        functions.printBoard(board)
        print()
        row = int(input('Input Row: '))
        assert row < functions.numRows
        assert row >= 0
        col = int(input('Input Col: '))
        print()
        assert col < functions.numRows
        assert col >= 0
        assert functions.isEmpty(row, col, board)
        board[row][col] = True
    else:
        functions.printBoard(board)
        time.sleep(random.randint(0, 2))
        print()
        board = mark1.play(board)
    turn = not turn

functions.printBoard(board)
print()

if functions.isGameOver(board) == False:
    print('You lose!')
elif functions.isGameOver(board) == True:
    print('You win!')
	def testMyFxn(self):
		self.assertTrue(functions.isEmpty([]))
		self.assertFalse(functions.isEmpty([1,2]))