Mac os find application using port

How to Use the Port Scanner in Mac OS X Network Utility

Mac OS X comes with a bundled port scanner tool, just one of a variety of features tucked into the ever useful Network Utility app. That means you don’t need to bother with the command line or install more advanced tools like nmap to quickly scan for open ports on a given IP or domain, instead you can do it all through the friendly graphical interface. Despite being a fairly advanced utility, it’s actually very easy to use.

Quick sidenote: remember that newer releases of Mac OS X have relocated Network Utility to be buried in a system folder, that doesn’t mean it can’t be used, it just means you have to either make an alias, launch it from Spotlight, or get to it from System Info. For the purpose of this walkthrough we’ll use Spotlight to launch Network Utility and start the scan since it’s the easiest and quickest route, though if you plan on using the tool often you’ll probably want to make an alias yourself. OK, let’s jump right to scanning ports.

How to Scan Ports on an IP or Domain from Mac OS X

You can choose any local or remote IP to scan, if you’re solitary on a network (or even air gapped) and still want to try this out yourself, use the loopback IP of “127.0.0.1” as the target:

  1. Hit Command+Spacebar to summon Spotlight and type “Network Utility” followed by the return key to launch the Network Utility app
  2. Select the “Port Scan” tab
  3. Enter the IP or domain name you wish to scan for open ports and choose “scan”
  4. Optional, but not necessarily recommended, you can set a port range to scan between if you just want to search for a specific set of active services

127.0.0.1 or “localhost” will just check the local Mac for open ports, if you’re new to port scanning that may be the preferred way to go since most reasonably well secured remote domains reject incoming requests or don’t respond to them.

Let the Port Scan tool run and you will quickly start to see any open TCP ports and their traditionally identified usage. For example, you may see something like this if you scan localhost (127.0.0.1):

Port Scan has started…
Port Scanning host: 127.0.0.1
Open TCP Port: 22 ssh
Open TCP Port: 80 http
Open TCP Port: 88 kerberos
Open TCP Port: 445 microsoft-ds
Open TCP Port: 548 afpovertcp
Open TCP Port: 631 ipp
Open TCP Port: 3689 daap

Visible ports are going to differ per machine depending on what services and servers are available, but if you’re scanning Macs and PC’s you’ll commonly find web servers, SMB Windows sharing port 445, AFP Apple File Sharing on port 548, maybe active visible SSH server on 22, UDP servers, and potentially a wide variety of others. The port scan will go quite high as it scans, so just let it run if you want to see everything.

If you see absolutely nothing come up but you know an IP is active with open services, either the machine isn’t broadcasting, the recipient machine is rejecting all requests, or perhaps a strong firewall is configured. This makes Network Utility’s port scanner an excellent way to quickly check security and test out potential vulnerabilities or active services on neighboring Macs, iOS devices, Windows, Linux machines, and whatever other computers are getting scanned.

Network Utility is obviously limited to the Mac, and while there are no built-in tools on the iOS side of things, it is possible to perform port scanning from an iPhone and iPad with the fing app a free tool that is very handy addition to the advanced iOS users toolkit.

Источник

The port 80 in Mac is used

We have to use port 80 for our server. But when I was trying to use it in Mac, it always said that the 80 is used, but I don’t know which program uses it.

I searched it in Google, and someone said it’s about apache, but I tried, which is not working. I found this: https://gist.github.com/kujohn/7209628 , but seems it’s not working visiting our server by IP address.

I really don’t know what’s going on and how can I find out which program using port 80 and stop it.

Many thanks if anyone can help, I’m new using Mac. Thanks.

6 Answers 6

To find out what process is using port 80

  1. go to Applications
  2. open utilities.
  3. open Activity Monitor.
  4. click on the Memory tab,
  5. look at the ports and the processes using them. Find port 80 and select it
  6. go to the view on the menu bar and choose Quit process.

This will just kill the process, it will not stop a server instance that is already running from continuing to run. (Correction: the Ports column shows the number of open ports (and files?), not the port number)

It is not clear if you are using a database management system or not and which one but one method that has worked for me using MAMP is as follows.

  • stop the server by using sudo apachectl stop command.
  • then change the port to port 80.
  • then restart your servers.
Читайте также:  Работа с графическим редактором windows paint

Источник

How do I close an open port from the terminal on the Mac?

I opened port #5955 from a java class to comunicate from a client. How do i close this port after I am done? and also which command can show me if port open or closed?

14 Answers 14

Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free

Kill the process which is currently using the port using its PID

To find the process try:

Kill the process which is currently using the port using its PID

and then check to see if the port closed. If not, try:

I would only do the following if the previous didnt work

Just to be safe. Again depending on how you opened the port, this may not matter.

In 2018 here is what worked for me using MacOS HighSierra:

sudo lsof -nPi :yourPortNumber

sudo kill -9 yourPIDnumber

very simple find port 5900:

then considering 59553 as PID

However you opened the port, you close it in the same way. For example, if you created a socket, bound it to port 0.0.0.0:5955, and called listen, close that same socket.

You can also just kill the process that has the port open.

If you want to find out what process has a port open, try this:

If you want to know whether a port is open, you can do the same lsof command (if any process has it open, it’s open; otherwise, it’s not), or you can just try to connect to it, e.g.:

If it returns immediately with no output, the port isn’t open.

It may be worth mentioning that, technically speaking, it’s not a port that’s open, but a host:port combination. For example, if you’re plugged into a LAN as 10.0.1.2, you could bind a socket to 127.0.0.1:5955, or 10.0.1.2:5955, without either one affecting the other, or you could bind to 0.0.0.0:5955 to handle both at once. You can see all of your computer’s IPv4 and IPv6 addresses with the ifconfig command.

Источник

Ports Open (Networking)

What ports are open for hacking on my Mac and Linux machine?

Here is how to see what ports are open listening on a server.

This is perhaps the most important potential vulnerability.

Having ports listenting to outside traffic also takes CPU effort, which consumes electricity and thus reduce battery life.

Ports

PAT (Port Address Translation) maps ports.:

  • 0 — 1023 = well-know ports
  • 1024 — 49141 = Registered ports (1433 for MS SQL, 1431 for Oracle SQL, etc.)
  • 49152 — 54535 65535 = dynamic ports

Port 3389 is used for communicating with Microsoft’s RDP (Remote Desktop Protocol) on Windows machines. See My notes on Windows RDP.

Common TCP Ports in layer 4: REMEMBER

    80/443 = HTTPS (Secure, encrypted)

21/990 = FTP and FTPS which adds SSL & TLS to encrypt

3389 = RDP (Remote Desktop Protocol) from Microsoft

143/993 = IMAP (Internet Message Access Protocol) files remain on server / TLS

No port for ICMP RFC 792 Pings RFC 1122 as it’s in IP transport layer

  • 389/646 = LDAP / Secure LDAP
  • 88 = Kerberos (Windows)
  • 445 = SMB (Server Message Block) from Azure Files
  • 548 = AFP (Apple Filing Protocol) https://www.wikiwand.com/en/Apple_Filing_Protocol elim. for AppleTalk
    • 8080, 8081 = Limits Microservice
    • 8888 = Spring Cloud Config server
    • 8000,8001,8002,… = Currency Exhange Microservice
    • 8100,8101,8102,… = Currency Conversion Microservice
    • 8761 = Netflix Eureka Naming Server
    • 8765 = API Gateway
    • 9411 = Zipkin Distributed Tracing Server

    IP header protocol field REMEMBER

    • 1 = ICMP (Internet Control Message Protocol)
    • 2 = IGMP (Internet Group Management Protocol) to estab. multicaset group transmitted to at once
    • 6 = TCP (Transmission Control Protocol)
    • 17 = UDP (User Datagram Protocol) used by VOIP
    • 115 = L2TP (Layer 2)

    Spotlight on Network Utility to List Ports

    Apple’s macOS Spotlight is like Window’s Search omni-box. *

    Press Command+Spacebar.

    Type the name of utilities that are buried, such as Network Utility.

    Click the keyboard return/enter key to launch the Network Utility app.

    Select the «Port Scan» tab.

    Enter the IP (such as 127.0.0.1), localhost, or domain name you wish to scan for open ports.

    Choose scan to see what ports the server responds to.

    List open files = lsof

    In a Terminal command line:

    PROTIP: If you’ll be using this often, create an alias such as of .

    “lsof” is a contraction for “list open files”. Without any options specifications, lsof lists all open files belonging to all active processes.

    “-nP” is a combination of “n” for no resolution of IPs to hostnames using DNS and “P” for no resolution of Port names from numbers.

    This is because the command already takes several seconds to run.

    “+c 15” specifies command width of 15.

    Piping to grep filters out only lines containing “LISTEN”.

    NOTE: All options are shown by this command:

    Drag your Terminal window wider to remove word-wrap.

    “FD” column lists File Descriptors. “u” is for read and write mode. “r” for read only, “w” for write-only.

    Linux requires root on operations for well-known ports below 1024.

    Protocols

    TCP (Transmission Control Protocol) is the most commonly used protocol on the Internet and any TCP/IP network. TCP enables two hosts to establish a connection and exchange streams of data. TCP guarantees delivery of data and that packets will be delivered in the same order in which they were sent. Guaranteed communication/delivery is the key difference between TCP and UDP on ort 53.

    UDP (Datagram Protocol) is connectionless and does not guarantee reliable communication; it’s up to the application that received the message to process any errors and verify correct delivery. UDP is often used with time-sensitive applications, such as audio/video streaming, where dropping some packets is preferable to waiting for delayed data.

    Processes Tour

    NOTE: Drag the scroll bar to see what is beyond what is displayed.

    mongod is MongoDB listening on port 27017.

    I should keep that closed unless I need it.

    In Node, close all connections when the app closes completely:

    2BUA8C4S2C

    When I search for “2BUA8C4S2C” I see “2BUA8C4S2C.com.agilebits” in folder /Users/mac/Library/Group Containers

    This says This port is used only on the loopback interface (127.0.0.1) for the 1Password extension to talk to the 1Password Agent. It should be safe to firewall it from any sources other than 127.0.0.1. If you do a packet capture on lo0 and then filter by tcp.port == 6258 you can see what traffic is being passed. Nothing is transmitted in the clear.

    Skype I don’t mind keeping open. I use it a lot.

    Dropbox — why does it need to be kept open?

    I’ll use just their web page when I need it.

    Resilio\x20Sync I used once to get a file.

    In Resilio Preferences, uncheck “Start Resilio Sync on startup”.

    SketchMirrorHel

    XMPP ports 56989 and 56990

    For a list of processes on Mac:

    Don’t visit http://www.westwind.com/reference/OS-X/background-processes.html

    ftp (tftp) should not appear.

    Scan other machines

    brew install nmap

    (Zenmap is the GUI)

    There are a lot of options

    nmap -h

    nmap [scan type] [options]

    There are a lot of options

    nmap -h

    Scan for vulnerabilities using nmap scripts.

    Scan for vulnerabilities using vulnerability scanners:

    Scans for versions of applications and operating systems. Compare those against known vulnerabilities and exploits.

    Devices on the Internet with open ports are indexed by Shodan.io.

    SNR (software defined radios)

    Resources

    Learn basic hardware hacking with UbertoothOne and HackRF One.

    Network Intrusion detection systems (NIDS)

    AlienVault Open Source SIEM (OSSIM) with Open Threat Exchange (OTX) Security Information and Event Management (SIEM) software.

    Honeypots

    Commercial Honeypot software:

    • Fortinet – FortiDeceptor
    • Attivio — BOTsink
    • Fidelis – Fidelis Deception
    • TrapX– DeceptionGrid
    • Illusive – Illusive Platform

    Источник

    The MacPorts Project

    Quickstart

    1. Install Xcode and the Xcode Command Line Tools
    2. Agree to Xcode license in Terminal: sudo xcodebuild -license
    3. Install MacPorts for your version of the Mac operating system:
      • macOS Big Sur v11
      • macOS Catalina v10.15
      • macOS Mojave v10.14
      • Older OS? See here.

    Installing MacPorts

    MacPorts version 2.7.1 is available in various formats for download and installation (note, if you are upgrading to a new major release of macOS, see the migration info page):

    • “pkg” installers for Big Sur, Catalina, and Mojave, for use with the macOS Installer. This is the simplest installation procedure that most users should follow after meeting the requirements listed below. Installers for legacy platforms High Sierra, Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion, Lion, Snow Leopard, Leopard and Tiger are also available.
    • In source form as either a tar.bz2 package or a tar.gz one for manual compilation, if you intend to customize your installation in any way.
    • Git clone of the unpackaged sources, if you wish to follow MacPorts development.
    • The selfupdate target of the port(1) command, for users who already have MacPorts installed and wish to upgrade to a newer release.

    Checksums for our packaged downloads are contained in the corresponding checksums file.

    The public key to verify the detached GPG signatures can be found under the attachments section on jmr’s wiki page. (Direct Link).

    Please note that in order to install and run MacPorts on macOS, your system must have installations of the following components:

    Apple’s Xcode Developer Tools (version 12.2 or later for Big Sur, 11.3 or later for Catalina, 10.0 or later for Mojave, 9.0 or later for High Sierra, 8.0 or later for Sierra, 7.0 or later for El Capitan, 6.1 or later for Yosemite, 5.0.1 or later for Mavericks, 4.4 or later for Mountain Lion, 4.1 or later for Lion, 3.2 or later for Snow Leopard, or 3.1 or later for Leopard), found at the Apple Developer site, on your Mac operating system installation CDs/DVD, or in the Mac App Store. Using the latest available version that will run on your OS is highly recommended, except for Snow Leopard where the last free version, 3.2.6, is recommended.

    With Xcode 4 and later, users need to accept the Xcode EULA by either launching Xcode or running:

    Apple’s Command Line Developer Tools, which can be installed on recent OS versions by running this command in the Terminal:

    Older versions are found at the Apple Developer site, or they can be installed from within Xcode back to version 4. Users of Xcode 3 or earlier can install them by ensuring that the appropriate option(s) are selected at the time of Xcode’s install («UNIX Development», «System Tools», «Command Line Tools», or «Command Line Support»).

  • (Optional) The X11 windowing environment, for ports that depend on the functionality it provides to run. You have multiple choices for an X11 server:
    • Install the xorg-server port from MacPorts (recommended).
    • The XQuartz Project provides a complete X11 release for macOS including server and client libraries and applications.
    • Apple’s X11.app is provided by the “X11 User” package on older OS versions. It is always installed on Lion, and is an optional installation on your system CDs/DVD with previous OS versions.
  • macOS Package (.pkg) Installer

    The easiest way to install MacPorts on a Mac is by downloading the pkg or dmg for Big Sur, Catalina, Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion, Lion, Snow Leopard, Leopard or Tiger and running the system’s Installer by double-clicking on the pkg contained therein, following the on-screen instructions until completion.

    This procedure will place a fully-functional and default MacPorts installation on your host system, ready for usage. If needed your shell configuration files will be adapted by the installer to include the necessary settings to run MacPorts and the programs it installs, but you may need to open a new shell for these changes to take effect.

    The MacPorts “ selfupdate ” command will also be run for you by the installer to ensure you have our latest available release and the latest revisions to the “Portfiles” that contain the instructions employed in the building and installation of ports. After installation is done, it is recommended that you run this step manually on a regular basis to to keep your MacPorts system always current:

    At this point you should be ready to enjoy MacPorts!

    Type “ man port ” at the command line prompt and/or browse over to our Guide to find out more information about using MacPorts. Help is also available.

    Source Installation

    If on the other hand you decide to install MacPorts from source, there are still a couple of things you will need to do after downloading the tarball before you can start installing ports, namely compiling and installing MacPorts itself:

    1. “ cd ” into the directory where you downloaded the package and run “ tar xjvf MacPorts-2.7.1.tar.bz2 ” or “ tar xzvf MacPorts-2.7.1.tar.gz ”, depending on whether you downloaded the bz2 tarball or the gz one, respectively.
    2. Build and install the recently unpacked sources:
      • cd MacPorts-2.7.1
      • ./configure && make && sudo make install

      Optionally:

      • cd ../
      • rm -rf MacPorts-2.7.1*

    These steps need to be perfomed from an administrator account, for which “ sudo ” will ask the password upon installation. This procedure will install a pristine MacPorts system and, if the optional steps are taken, remove the as of now unnecessary MacPorts-2.7.1 source directory and corresponding tarball.

    To customize your installation you should read the output of “ ./configure —help | more ” and pass the appropriate options for the settings you wish to tweak to the configuration script in the steps detailed above.

    You will need to manually adapt your shell’s environment to work with MacPorts and your chosen installation prefix (the value passed to configure ‘s —prefix flag, defaulting to /opt/local ):

    • Add $/bin and $/sbin to the start of your PATH environment variable so that MacPorts-installed programs take precedence over system-provided programs of the same name.
    • If a standard MANPATH environment variable already exists (that is, one that doesn’t contain any empty components), add the $/share/man path to it so that MacPorts-installed man pages are found by your shell.
    • For Tiger and earlier only, add an appropriate X11 DISPLAY environment variable to run X11-dependent programs, as Leopard takes care of this requirement on its own.

    Lastly, you need to synchronize your installation with the MacPorts rsync server:

    Upon completion MacPorts will be ready to install ports!

    It is recommended to run the above command on a regular basis to keep your installation current. Type “ man port ” at the command line prompt and/or browse over to our Guide to find out more information about using MacPorts. Help is also available.

    Git Sources

    If you are developer or a user with a taste for the bleeding edge and wish for the latest changes and feature additions, you may acquire the MacPorts sources through git. See the Guide section on installing from git.

    Purpose-specific branches are also available at the https://github.com/macports/macports-base/branches url.

    Alternatively, if you’d simply like to view the git repository without checking it out, you can do so via the GitHub web interface.

    Selfupdate

    If you already have MacPorts installed and have no restrictions to use the rsync networking protocol (tcp port 873 by default), the easiest way to upgrade to our latest available release, 2.7.1, is by using the selfupdate target of the port(1) command. This will both update your ports tree (by performing a sync operation) and rebuild your current installation if it’s outdated, preserving your customizations, if any.

    Other Platforms

    Running on platforms other than macOS is not the main focus of The MacPorts Project, so remaining cross-platform is not an actively-pursued development goal. Nevertheless, it is not an actively-discouraged goal either and as a result some experimental support does exist for other POSIX-compliant platforms such as *BSD and GNU/Linux.

    The full list of requirements to run MacPorts on these other platforms is as follows (we assume you have the basics such as GCC and X11):

    • Tcl (8.4 or 8.5), with threads.
    • mtree for directory hierarchy.
    • rsync for syncing the ports.
    • cURL for downloading distfiles.
    • SQLite for the port registry.
    • GNUstep (Base), for Foundation (optional, can be disabled via configure args).
    • OpenSSL for signature verification, and optionally for checksums. libmd may be used instead for checksums.

    Normally you must install from source or from an git checkout to run MacPorts on any of these platforms.

    Help on a wide variety of topics is also available in the project Guide and through our Trac portal should you run into any problems installing and/or using MacPorts. Of particular relevance are the installation & usage sections of the former and the FAQ section of the Wiki, where we keep track of questions frequently fielded on our mailing lists.

    If any of these resources do not answer your questions or if you need any kind of extended support, there are many ways to contact us!

    Copyright © 2002–2021, The MacPorts Project. All rights reserved.

    Источник

    Читайте также:  Защитник windows 10 как очистить журнал защиты
    Оцените статью