- Ports Open (Networking)
- Ports
- Spotlight on Network Utility to List Ports
- List open files = lsof
- Protocols
- Processes Tour
- For a list of processes on Mac:
- Resources
- Honeypots
- Find the Process Listening to Port on Mac OS X
- Step-by-Step
- Find the Process ID (PID)
- Find the Process ID (PID) Using lsof
- Find the Process ID (PID) Using netstat
- Find the Process Name
- Other Useful Commands
- How to Kill or Stop the Process by PID
- The lsof Command
- Просмотр сведений о процессах на Mac в приложении «Мониторинг системы»
- Просмотр активности процесса
- Отображение других столбцов
- Группировка процессов для удобного просмотра
- Установка и работа с менеджером пакетов для Maс OS X (MacPort и Homebrew)
- 1. MacPort
- 2. Homebrew
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
- 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
Источник
Find the Process Listening to Port on Mac OS X
Step-by-Step
To find the process that is listening to a port on Mac OS X, we’ll use the lsof command to find the process ID (PID), and the ps command to show the name.
Find the Process ID (PID)
There are two different ways we can use to find the process that is listening to a port on Mac OS X.
Find the Process ID (PID) Using lsof
Using the lsof command we can find the process ID (PID) for a specific port that is in a LISTEN state. In a terminal type the following and replace the “
” with our port number.
This generates output that looks like this:
In the output above the PID (process ID) is the second value, in this example output the process ID (PID) is “63851”. This command will also print out the port number, which is 9999 in the above output example.
Find the Process ID (PID) Using netstat
Using the nestat command we can find the process ID (PID) for a specific port. In a terminal type the following and replace the “
” with our port number.
This generates output that looks like this:
In the output above the PID (process ID) is the ninth value (the fourth value from the end), in this example output the process ID (PID) is “63851”. This command will also print out the port number, which is 9999 in the above output example.
Find the Process Name
We can now use the process status command ps to display the process name for the process ID (PID).
This generates output that looks like this:
In the output above the process name is the last value “the-process.” Now we know the name of the process that is listening to the port. The reason as to why the grep command is listed twice is to avoid displaying the process ID (PID) for the grep command itself.
Other Useful Commands
How to Kill or Stop the Process by PID
You can kill the process by process ID (PID) using the kill command. Replace “
” with the process ID from lsof or netstat.
The lsof Command
The lsof command lists open files. Network sockets count as files, so each open network socket, either listening or actively in use is listed by lsof. In addtion you can run the man lsof command to display all the different options for lsof.
lsof can take a very long time to execute, so I suggest that you use -n (inhibits the conversion of network numbers to host names for network files) and -P (inhibits the conversion of port numbers to port names for network files) to speed it up.
Источник
Просмотр сведений о процессах на Mac в приложении «Мониторинг системы»
Процессы — это программы, которые выполняются на Mac. Процессы могут представлять собой приложения, системные приложения, используемые macOS, или невидимые фоновые процессы.
С помощью Мониторинга системы можно получать информацию об этих процессах, в том числе о количестве используемой ими памяти и времени процессора.
Просмотр активности процесса
В приложении «Мониторинг системы» на Mac можно сделать следующее.
Получение информации о процессе. Выберите процесс, затем дважды нажмите на него или нажмите кнопку информации в окне Мониторинга системы (или используйте Touch Bar).
Сортировка процессов. Чтобы отсортировать список, нажмите заголовок столбца.
Сортировка элементов столбца в обратном порядке. Нажмите треугольник в заголовке выбранного столбца.
Просмотр общей информации обо всех процессах. Нажмите «ЦП» в окне Мониторинга системы (или воспользуйтесь панелью Touch Bar). Сведения, в том числе общее количество открытых процессов и потоков, появятся в нижней области окна.
Поиск процесса. Введите название процесса или приложения в поле поиска.
Отображение других столбцов
Можно выбрать столбцы, которые будут отображаться в окне Мониторинга системы.
В приложении «Мониторинг системы» на Mac выберите меню «Вид» > «Столбцы», затем выберите столбцы для отображения (отображаемые столбцы отмечены галочкой).
Группировка процессов для удобного просмотра
В приложении «Мониторинг системы» на Mac в меню «Вид» выполните одно из следующих действий.
Все процессы. Показать все процессы, запущенные на Mac.
Все процессы, иерархически. Показать процессы, принадлежащие другим процессам, чтобы Вы могли видеть существующие между ними отношения «родитель-потомок».
Мои процессы. Показать процессы, принадлежащие Вашей учетной записи.
Процессы системы. Показать процессы, принадлежащие macOS.
Процессы других пользователей. Показать процессы, не принадлежащие корневому или текущему пользователю.
Активные процессы. Показать запущенные процессы, не находящиеся в режиме ожидания.
Неактивные процессы. Показать запущенные процессы, находящиеся в режиме ожидания.
Процессы ГП. Показать запущенные процессы, которые обрабатывает ГП компьютера.
Процессы в окнах. Показать процессы, способные создавать окна. Такие процессы обычно являются приложениями.
Выбранные процессы. Показывает только процессы, выбранные в окне Мониторинга системы.
Программы за последние 12 часов. Показать только приложения, запускавшие процессы за последние 12 часов.
Процессы, по ГП. Показать запущенные процессы ГП, сгруппированные по ГП.
По умолчанию данные в окне Мониторинга системы обновляются каждые 5 секунд. Об изменении этого параметра см. в разделе Изменение частоты обновления информации.
Источник
Установка и работа с менеджером пакетов для Maс OS X (MacPort и Homebrew)
Менеджер пакетов в Mac OS X позволит нам легко работать с пакетам посторонних разработчиков. В этом топике рассмотрим два таких менеджера: MacPort и Homebrew.
1. MacPort
Официальний сайт
На этом же сайте можна найти Mac OS X Package (.pkg) Installer для Mountain Lion, Lion, Snow Leopard и Leopard. Установите подходящий вам пакет и пользуйтесь на здоровье. Есть и другие способы установки, но мы выбрали простой и быстрый. На случей чево, у меня port установился сюда: /opt/local/bin/port.
Требование:
Работать с port придельно просто — ищем в «портах» нужный пакет и устанавливаем его:
Дополнительные команды:
2. Homebrew
Официальная страница
О Homebrew поговорим подробнее…
Требование:
Установка:
После успешной установки виполним следующую команду:
Если в результате этой команди получим ответ: «Your system is raring to brew», тогода все хорошо и можете спокойно начинать работу з brew. В ином случае продолжим…
Если возникла ошибка Warning: Experimental support for using Xcode without the «Command Line Tools», то скорее всего была обновлена «ось», к примеру, с Lion к Mountain Lion, но не была переустановлена Command Line Tools для Xcode.
Если возникла ошибка Error: No such file or directory — /usr/local/Cellar, то нужна создать эту директорию:
После этого опять запускаем команду:
Если мы получим что-то вроде этого:
то исправляем примером так:
Проверяем ище раз:
Если на этот раз никаких ошибок не произошло, тогда все — можна спокойно работать с Homebrew.
Источник