def threadedPingReverseSave(addr): #Drop trailing /xx ip = (addr['address'].split("/"))[0] #Run ping twice - first to ensure ARP completes before second ping goes through #this is often visible in labs where the first ping to a newly online device will fail ping.do_one(ip, timeout, 64) rtt = ping.do_one(ip, timeout, 64) #Create the appropriate search string for a PTR record by reversing the IP space and #adding in-addr.arpa to the query dnsreq = '.'.join(reversed(ip.split("."))) + ".in-addr.arpa" #If the ping failed... if rtt == None: if __debug__: print(ip + ": NO RESPONSE BEFORE ICMP TIMEOUT EXPIRY") #There's not a great answer here, so we're going to assume the IP is merely reserved #Feel free to adjust this to your needs addr['status'] = 2 try: #Do a reverse DNS (aka pointer/PTR) query myResolver.query(dnsreq, "PTR") dnsreply = myResolver.query(dnsreq, "PTR").response.answer for i in dnsreply: for j in i.items: #Save the reply to the description addr['description'] = j.to_text().rstrip('.') #Always save IP addresses with a reverse. saveAddr(addr) except: #If there is no reply, set the description variable to... addr['description'] = "No reverse." #No ping, but it is an IP-address scan, so we should save the result #Otherwise, it's from a prefix or RFC1918 space, so do NOT save it #this allows you to programmatically pull free IP addresses as needed if load_scanner_from_rfc1918_or_netbox == 2: saveAddr(addr) #raise #If the ping succeeded... else: addr['status'] = 1 try: #Do a reverse DNS (aka pointer/PTR) query myResolver.query(dnsreq, "PTR") dnsreply = myResolver.query(dnsreq, "PTR").response.answer for i in dnsreply: for j in i.items: #Save the reply to a description variable desc = j.to_text() except: #If there is no reply, set the description variable to... desc = "No reverse.." #raise if __debug__: print(ip + ": " + str(rtt) + "s and reverse: " + desc) #Remove the right-most period (DNS resolver returns one, e.g. example.com.) addr['description'] = desc.rstrip('.') #Always save successful pings saveAddr(addr) result = addr return result
def send_ping(st1, en1): for each in xrange(st1, en1): try: ip = net2 + str(each) ping.do_one(ip, 1, 32) except Exception as e: print "Error in send_ping", e
def _ping(url): try: print("{} - Checking connection ".format(url)) # Can't ping a url with http:// or https:// on it for some reason testurl = url.replace("http://", "").replace("https://", "") ping.do_one(testurl, timeout=5, psize=5) except socket.error as e: print("{} - ERROR Can't connect".format(url))
def ping(self): l = ni.ifaddresses('eth0') try: return ping.do_one(l[2]['addr']) > 0 except: try: return ping.do_one(l[2][0]['addr']) > 0 except: return False
def ping_card(self): while self.listen_flag: try: resp=ping.do_one(self.card_ip) except socket.error: pass time.sleep(20)
def networking(shared): last_state = shared.state shared.phone_attempts = {} for name, addr in shared.phone_ips.items(): shared.phone_attempts[name] = shared.phone_max_attempts # Set to max to indicate phone starts as 'gone' while True: # Start with a none state state = 'none' for name, addr in shared.phone_ips.items(): try: speed = ping.do_one(addr, 1, 64) # Timeout of 1 second, send 64 bytes if speed is None: shared.phone_attempts[name] += 1 else: shared.phone_attempts[name] = 0 except: print "Ping failed. Network issue?" for name, count in shared.phone_attempts.items(): if count == shared.phone_max_attempts: print "Phone of", name, "is considered gone." elif count == 1: print "Phone of", name, "might be leaving wifi range... attempting up to", shared.phone_max_attempts, "pings..." if count < shared.phone_max_attempts: state = name if state == 'none' else 'both' shared.state = state if shared.state != last_state: print "State changed to", shared.state, "@", datetime.datetime.now() last_state = shared.state time.sleep(1)
def discover(): global db_lock db_lock.acquire() # you must create a Cursor object. It will let # you execute all the queries you need cur = db.cursor() # Use all the SQL you like cur.execute( "SELECT `tag`, `ipv4_address` " + "FROM hosts " + "WHERE `ipv4_address` IS NOT NULL AND `deployed` = 0 " + "ORDER BY `name`") # print all the first cell of all the rows for row in cur.fetchall(): try: ret = ping.do_one(row[1], 0.1) except socket.error: ret = None except socket.gaierror: ret = None if ret: event_deployed(row[0]) cur.close() db.commit() db_lock.release()
def run(self): print "* Running" try: while self.active: if not self.connected: try: delay = ping.do_one('cob-sim1', timeout=2) print "* Delay: %s" % str(delay) self.connect() except socket.timeout as e: print "* Timed out (connected: %s)" % str(self.connected) except Exception as e: print "* Error: %s" % str(e) else: try: i,o,e = self.client.exec_command("uptime") print "O: %s\tE: %s" % (o.read().strip(), e.read().strip()) except Exception as e: print "* Disconnected!" self.connected = False time.sleep(2) finally: try: self.client.close() except Exception as e: print e
def ping_failsafe(self): if self.ping_timeout != -1: while not self.safe_exit: if ping.do_one(self.base_ip, self.ping_timeout) != None: time.sleep(self.ping_delay) else: self.trigger_failsafe(source="ping")
def ping(dest_addr, timeout=2, count=2, psize=64): """Pings a given host and returns True if it answers, otherwise False. It tries to use a pure python icmp library which requires begin root, so there is a `fping` fallback which is useful when running as a developer """ try: plist = [] for i in xrange(count): try: delay = do_one(dest_addr, timeout, psize) except socket.gaierror, e: log.msg("ping %s failed. (socket error: '%s')" % (dest_addr, e[1]), system='ping') break if delay is not None: delay = delay * 1000 plist.append(delay) # Find lost package percent lost = 100 - (len(plist) * 100 / count) return lost != 100
def run_ping(n, cut, host): bins = {} binsize = 1 count = 0 cur_avg = 0 cur_avg2 = 0 timeout = 100 packetsize=100 #ion() #show() for i in range(n): ping_result = ping.do_one(host, timeout, packetsize) if ping_result is None: return x = 1000*ping_result if x < cut: count += 1 cur_avg = (cur_avg*(count-1) + x)/count cur_avg2 = (cur_avg2*(count-1) + math.pow(x, 2))/count updatebins(bins, binsize, int(x)) print bins #if count % 10 == 0: # b, a = finalizebins(bins, binsize) # print b,a # pause(0.0001) # bar(b,a) # draw() b, a = finalizebins(bins, binsize) std = math.sqrt(cur_avg2-math.pow(cur_avg, 2)) return b, a, cur_avg, std
def main(): # Check if argument was supplied if len(sys.argv) > 1: # Define valid IP valid_ip = re.match("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", sys.argv[1]) # Define valid FQDN valid_fqdn = re.match("(?=^.{1,254}$)(^(?:(?!\d|-)[a-zA-Z0-9\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)", sys.argv[1]) # Check id valid IP or FQDN if not valid_ip or valid_fqdn: print 'status', 'supplied argument is an invalid IP or FQDN' sys.exit(1) else: # Priint error message and exit print 'status', 'Please supply and IP or FQDN' sys.exit(1) # Set target target = sys.argv[1] # Ping target ping_result = ping.do_one(target, ping_timeout, packet_size) # Check if we got a response if not ping_result: # Exit if we got no response print 'status', target, 'is unreachable' sys.exit(1) else: # If we got a response print the metrics print 'status', target, 'is alive' print 'metric', 'ping', 'double', '{0:g}'.format(ping_result) sys.exit(0)
def server_is_up(host): delay = ping.do_one(host, ping_timeout, ping_packet_size) print "ping delay: " + str(delay) if delay is not None: return 1 else: return 0;
def ping(ip,retry=3,timeout=2,pkt_size=10): for x in range(int(retry)): try: if pong.do_one(ip,int(timeout),int(pkt_size)): return True except IOError,e: return False except:
def is_valid_fqdn_domain(domain): res = ping.do_one(dest_addr=domain, timeout=2, psize=64) # Returns either the delay (in seconds) or none on timeout. if res is not None: return True else: return False
def pinger(): try: return ping.do_one('pellet.cave.kevinross.name') > 0 except: with open('/tmp/pings', 'a') as o: traceback.print_exc(file=o) o.write('\n') return False
def worker(queue,host,timeout=1): try: delay = (ping.do_one(host,timeout,ICMP_DATA_SIZE) or 0) * 1000 queue.put((host,delay)) except Exception: delay = 0 queue.put(("%s not found"%host,delay)) queue.close()
def pingIp(ip): try: p = ping.do_one(ip, timeout=2, psize=8) return p # delay = ping.Ping('www.wikipedia.org', timeout=2000).do() except socket.error, e: # print "Ping Error:", e pass
def run(self): count = 0 while self.flag: res = ping.do_one(self.target, TIMEOUT, PACKAGE_SIZE) if not res: count += 1 time.sleep(0.01) self.delay = (TIMEOUT + 0.01) * count
def run(self): alive_tmo = self.alive_interval * 60 while not self.kill.is_set(): if(ping.do_one(self.remote,self.timeout) != None): self.logger.connected(self.remote) elif (not self.kill.is_set()): self.logger.first_choice_disconnected(self.remote) if(ping.do_one(self.backup,self.timeout) != None): self.logger.connected(self.backup) else: self.logger.backup_disconnected(self.backup) self.kill.wait(self.interval) alive_tmo = alive_tmo - self.interval if(alive_tmo <= 0): self.logger.alive() alive_tmo = self.alive_interval * 60 self.killed.set()
def run(self): try: self.elapsed = ping.do_one("%s" % self.ip, 1) if (self.elapsed > 0): self.status = 1 except Exception as e: logger.debug('Errore durante il ping dell\'host %s: %s' % (self.ip, e)) self.status = 0 pass
def pingserver(server, timeout=2): import ping, socket try: delay = ping.do_one(server, timeout) if delay != None: return None error = "Ping failed. (timeout within %ssec.)" % timeout except socket.error, e: error = "Ping Error:" + str(e)
def run(self): while True: time.sleep(random.randint(30, 120)) text = 'Network Status: ' for name, ip in self.test_ips.items(): last_time = ping.do_one(ip, 3) last_time = int(last_time * 1000) if last_time else '-' text += '{0}: {1}ms, '.format(name, last_time) self.broadcast.put(text[:-2])
def run(self): delayList = deque(maxlen=100) lastTimeout = None netUp = True replySuccessCount = 0 replyFailCount = 0 # cls() while self.loop: try: delay = ping.do_one(self.endpoint, 3, 64) except socket.error: delay = None except select.error: delay = None if delay: delayList.append(delay) replySuccessCount += 1 replyFailCount = 0 else: lastTimeout = time() replySuccessCount = 0 replyFailCount += 1 if replySuccessCount >= 10 and not netUp: netUp = True if self.options.notify: showNotification('Net Status', 'Net is back!') if self.circuit['active'] == False: self.circuit['active'] = True oc.o_report_status(circuit_id, make_circuit_status(circuit_id, self.circuit['active'])) elif replyFailCount >= 10 and netUp: netUp = False if self.options.notify: showNotification('Net Status', 'Net is down!') if self.circuit['active'] == True: self.circuit['active'] = False oc.o_report_status(circuit_id, make_circuit_status(circuit_id, self.circuit['active'])) if not self.options.quite or not delay: # cls() if len(delayList): global latency latency = str(sum(delayList) / len(delayList) * 1000) print 'Circuit id ', self.circuit['id'], ' status of ', self.circuit['end_ip_address'], 'Average delay of last ', len(delayList), ' pings is ', sum(delayList) / len(delayList) * 1000, ' ms' if not self.options.quite and lastTimeout: logging.info( 'Last timeout was ', str(timedelta(seconds=time() - lastTimeout)), 'seconds ago.') elif lastTimeout: logging.info( 'Last timeout was at ', ctime(lastTimeout)) #else: # print 'There has been no timeouts yet! Hurray!' sleep(2)
def wakeup_network(host_name, n=20): return 1 import ping success = -1 for n in range(20): res = ping.do_one(host_name, 1, 1) if res is not None: success = n break return success
def is_up(ip, timeout, num_tries): for i in xrange(num_tries): result = ping.do_one(ip, timeout) if not result is None: return True # If it reached here without returning then the ping scan failed. # now do a tcp syn scan nm = nmap.PortScanner() res = nm.scan(hosts=ip, arguments="-n -sP -PE -PA21,23,80,3389") return res['scan'].values()[0]['status']['state'] == "up"
def _send_one_mac_arp(IPdst, timeout=0.01): # Remove any existing entry pid = Popen(["arp", "-d", IPdst], stdout=PIPE) s = pid.communicate()[0] # Check output? should be none # Now ping the destination try: ping.do_one("%s" % IPdst, timeout) except: pass # Timeout pid = Popen(["arp", "-n", IPdst], stdout=PIPE, stderr=PIPE) s = pid.communicate()[0] my_match = re.search(r"(([a-fA-F\d]{1,2}\:){5}[a-fA-F\d]{1,2})", s) if my_match: mac_str = _pad_mac_string(my_match.groups()[0]) if (not _is_technicolor(IPdst, mac_str)): logger.info('Trovato Host %s con indirizzo fisico %s' % (IPdst, mac_str)) return mac_str else : logger.debug("Found response from Technicolor")
def is_up(ip, timeout, num_tries): for i in xrange(num_tries): result = ping.do_one(ip,timeout) if not result is None: return True # If it reached here without returning then the ping scan failed. # now do a tcp syn scan nm = nmap.PortScanner() res = nm.scan(hosts=ip, arguments="-n -sP -PE -PA21,23,80,3389") return res['scan'].values()[0]['status']['state'] == "up"
def forever_ping(dest, index_flag, packetsize, tablebox, mainloop): global hosts global event last_column_width = get_last_column_width() dest_ip = socket.gethostbyname(dest) dest_attr = hosts[dest] dest_attr["ip"] = dest_ip dest_attr.setdefault("lost", 0) dest_attr.setdefault("lostp", "0%") dest_attr.setdefault("seq", 0) dest_attr.setdefault("real_rtt", SOCKET_TIMEOUT * 1000) dest_attr.setdefault("min_rtt", SOCKET_TIMEOUT * 1000) dest_attr.setdefault("max_rtt", SOCKET_TIMEOUT * 1000) dest_attr.setdefault("avg_rtt", SOCKET_TIMEOUT * 1000) dest_attr.setdefault("std", 0) dest_attr.setdefault("stat", "") rtts = dest_attr.setdefault("rtts", []) while event.is_set(): logging.info(f"ping {dest}, {index_flag}") delay = do_one(dest, SOCKET_TIMEOUT, packetsize, index_flag) with screen_lock: dest_attr["seq"] += 1 if delay is None: dest_attr["lost"] += 1 dest_attr["lostp"] = "{0:.0%}".format(dest_attr["lost"] / dest_attr["seq"]) block_mark = " " sleep_before_next_ping = WAIT_TIME else: delay_ms = int(delay * 1000) rtts.append(delay_ms) dest_attr["real_rtt"] = delay_ms dest_attr["min_rtt"] = min(dest_attr["rtts"]) dest_attr["max_rtt"] = max(dest_attr["rtts"]) dest_attr["avg_rtt"] = sum( dest_attr["rtts"]) / dest_attr["seq"] if len(rtts) >= 2: dest_attr["std"] = float("%2.1f" % (statistics.stdev(rtts))) block_mark = UNICODE_BLOCKS[min(delay_ms // 30, 7)] sleep_before_next_ping = WAIT_TIME - delay dest_attr["stat"] = (dest_attr["stat"] + block_mark)[-last_column_width:] try: rerender_table(mainloop, tablebox.table) except AssertionError: break logger.info( f"{dest}({dest_ip})Sleep for seconds {sleep_before_next_ping}") time.sleep(max(0, sleep_before_next_ping))
def one_ping(db, host): output_request(host) t = ping.do_one(host, INTERVAL_SECONDS, 32) rxd = (None != t) t_ms = int(t * 1000) if rxd else None insert_record(db, rxd, t_ms) output_result(rxd, t_ms) if rxd: t_wait = INTERVAL_SECONDS - t if t_wait > 0: time.sleep(t_wait)
def checkPing(addr, sec=1000): infoHandle("Checking Ping for %s" % addr) try: delay = ping.do_one(addr, sec, 64) if delay is None: return False return True except Exception, e: errorHandle("check ping - %s" % str(e)) return False
def _send_one_mac_arp(IPdst, timeout=0.01): # Remove any existing entry pid = Popen(["arp", "-d", IPdst], stdout=PIPE) s = pid.communicate()[0] # Check output? should be none # Now ping the destination try: ping.do_one("%s" % IPdst, timeout) except: pass # Timeout pid = Popen(["arp", "-n", IPdst], stdout=PIPE, stderr=PIPE) s = pid.communicate()[0] my_match = re.search(r"(([a-fA-F\d]{1,2}\:){5}[a-fA-F\d]{1,2})", s) if my_match: mac_str = _pad_mac_string(my_match.groups()[0]) if (not _is_technicolor(IPdst, mac_str)): logger.info('Trovato Host %s con indirizzo fisico %s' % (IPdst, mac_str)) return mac_str else: logger.debug("Found response from Technicolor")
def ping(self): try: d = ping.do_one(self.ip, self.p_timeout) if d is None: self.is_reachable = 0 else: self.is_reachable = 1 self.p_delay = d d = None except socket.gaierror: self.hostname = 'ip_err' self.is_reachable = 0
def ping(hostname, timeout=0.2, attempts=2, packet_size=64): """ping(hostname, [timeout, attempts, packet_size]) -> float Returns the ping value to a specified `hostname`. Possible customizations: `timeout`, `attempts` and `packet_size`.""" for i in xrange(attempts): try: result = do_one(str(hostname), timeout, packet_size) if result is not None: break except socket.error: result = None return result
def tick(self): try: delay= ping.do_one('192.168.1.1', 2) if delay is None: self.passes=0 self.fails+=1 else: self.passes+=1 self.fails=0 except socket.gaierror, e: print e self.passes = 0 self.fails+=1
def one_ping(ip): try: delay = do_one(ip, 0.1) except: delay = None if delay is None: res = -1 else: res = 0 print 'ping %s : %s' % (ip, 'active' if res == 0 else 'inactive') return ip, res
def run(self, result): server_ip = self.options.get('server_ip', '') connected = 1 for i in range(REPEAT_TIMES): res = ping.do_one(server_ip, TIMEOUT, PACKAGE_SIZE) if res: connected = 0 break keys = self.scenario_cfg.get('output', '').split() values = [connected] return self._push_to_outputs(keys, values)
def run(self): try: for _ in range(self._number): for target in self._addresses: delay = ping.do_one(target, 2, 64) if delay: print "%s: %.8f seconds" % (target, delay) else: print "%s not reachable" % target time.sleep(self._interval) except socket.error, e: pass
def render_tincpeers(self, request, tinc): res = [['name', 'address', 'subnet', 'signal']] for name, node in tinc.nodes.iteritems(): address = node.get('address', '') subnet = node.get('subnet', '') online = ok_icon(False) if subnet: ping = do_one(subnet, 1) if ping: online = format_ping(ping) else: online = format_ping(False) res.append([name, address, subnet, online]) return html.format_table(res)
def run(self): while True: self.logger.error("PING ["+str(self.tracker_index)+"] - Starting ping pass....") for x in range(0,self.retries-1): delay = ping.do_one(self.device,self.ping_timeout) if delay is not None: self.logger.error("Device: " + self.device + " - " + str(delay)) self.report_func(self.device, delay) # we are only retrying if not found break else: self.logger.error("Device: " + self.device + " - No Response") time.sleep(self.retry_pause) time.sleep(self.sleep_period)
def render_tincpeers(self, request, tinc): res = [["name", "address", "subnet", "signal"]] for name, node in tinc.nodes.iteritems(): address = node.get("address", "") subnet = node.get("subnet", "") online = ok_icon(False) if subnet: ping = do_one(subnet, 1) if ping: online = format_ping(ping) else: online = format_ping(False) res.append([name, address, subnet, online]) return html.format_table(res)
def findAddresses(): print('Finding viable IP addresses') ip_base = '' if testing: # If we are in the testing environment, feed it the IPs we know work return ['192.168.1.33', '192.168.1.46', '192.168.1.47', '192.168.1.48'] for chunk in range(0, 3): # Create base IP ip_base += ipaddr.split('.')[chunk] + '.' viable_ips = [] for ip in range(1, 254): ping_ip = ip_base + str(ip) result = ping.do_one(ping_ip, 0.05) if result is not None and portScan(ping_ip, '22'): viable_ips.append(ping_ip) print('Found viable IPs: ' + str(viable_ips)) return viable_ips
def main(): powered_on = False while 1: print "Checkin..." delay = ping.do_one(settings.PHONE_IP, 4, 64) if not delay and powered_on: xva730.power_off() powered_on = False print "Dude's offline" elif delay and not powered_on: xva730.power_on() powered_on = True print "Dude's online" print "Sleepin for 5..." time.sleep(5)
def wait_for_connection(self): self.debug("Waiting for connection to %s" % self.base_ip) self.add_thread_and_start(threading.Thread(target=self.udp_listener)) while not self.connected: if ping.do_one(self.base_ip, 2) != None: self.connected = True self.debug("Connected to %s" % self.base_ip) self.add_thread_and_start(threading.Thread(target=self.ping_failsafe)) self.udp_failsafe() self.debug("finishing up") for thread in self.threads: thread.join() self.debug("done")
def real_ping(destination, timeout=2, count=4): """ Use ICMP-Ping from ping.py :param string destination: :param int timeout: :param int count: """ total_delay = 0 for i in xrange(count): try: delay = do_one(destination, timeout) except socket.gaierror, e: return "Socket error: {}".format(e[1]) except socket.error, (msg): return "Socket error: {}".format(msg)
def do_ping(host, cursor): pings = [] timeouts = 0 for i in range(5): try: delay = ping.do_one(host, TIMEOUT) if delay == None: timeouts += 1 else: pings.append(delay) except socket.gaierror, e: return "error " + str(e)
def ping_host(dest_addr, timeout=0.1, psize=64): try: # packet size Maximum is 65507 if psize > 65507: em = "Error: packet size {0} is too large. Maximum is 65507".format( psize) LOG.exception(em) return False ret = ping.do_one(dest_addr, timeout, psize) if not ret: return False return True except Exception as e: em = "ping error. ip: <{0}>. msg: <{1}>".format(dest_addr, e) LOG.exception(em) return False
def do_ping (host, cursor) : pings = [] timeouts = 0 for i in range (5) : try : delay = ping.do_one(host, TIMEOUT) if delay == None : timeouts += 1 else : pings.append(delay) except socket.gaierror, e : return "error " + str(e)
def wait_for_connected(): messaged = False while True: try: if(ping.do_one("10.1.1.1",2) != None): break else: if messaged == False: print "Are you sure you're connected?" messaged = True except: if messaged == False: print "Are you sure you're connected?" messaged = True print "Connected!!"
def isMountOnline(self, mount_dir): try: if mount_dir == "/": return True for network in self.auto_network: if mount_dir.startswith(network[0]): print("check mount:", network[1] + ":" + mount_dir) delay = ping.do_one(network[1], 0.2) if delay: print("success", delay) return True else: print("failed") return False return True except Exception as e: print(str(e)) return True
def __call__(self): logging.getLogger(self.__generator__).info("Sending %s PING messages to %s (delay: %s)", self._num, self._host, self._delay) for _ in range(self._num): if ping.do_one(dest_addr = self._host, timeout = 5, psize = 64) is not None: logging.getLogger(self.__generator__).debug("Got PONG from %s", self._host) else: logging.getLogger(self.__generator__).debug("No response from %s", self._host) time.sleep(self._delay)
def icmpScan(tgtHost): print '\n\033[1;37m[\033[0m' \ '\033[1;33m * \033[0m' \ '\033[1;37m]\033[0m' \ ' \033[1;34mICMP\033[0m Scan Results for: '\ '\033[1;36m' + tgtHost + '\033[0m' pingResult = ping.do_one(tgtHost, 1, 10) if pingResult: print '\033[1;37m[\033[0m' \ ' + ' \ '\033[1;37m]\033[0m' \ ' \tHost \033[1;36m%s\033[0m is UP!!!' % tgtHost else: print '\033[1;37m[\033[0m' \ '\033[1;31m - \033[0m' \ '\033[1;37m]\033[0m ' \ '\tHost \033[1;36m%s\033[0ms is Down!!!' % tgtHost pass