Skip to content

Commit

Permalink
fixing cmake for rename of license file
Browse files Browse the repository at this point in the history
bumping up version # for release

Update README.md

Adding build status badge
  • Loading branch information
Javid Habibi committed Jul 16, 2020
1 parent b507eab commit 82ccfe2
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 80 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required (VERSION 3.13)
project (procmon)

# Set the project version number.
set (procmon_VERSION_MAJOR 0)
set (procmon_VERSION_MINOR 1)
set (procmon_VERSION_MAJOR 1)
set (procmon_VERSION_MINOR 0)
set (procmon_VERSION_PATCH 0)

# make ncurses a requirement
Expand Down Expand Up @@ -108,7 +108,7 @@ set(CPACK_PACKAGE_VERSION_PATCH "${procmon_VERSION_PATCH}")
set(AZDO_BUILD_ID "999999")

# setup license and readme for package
SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt)
SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)

# setup CPACK RPM Variables
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Process Monitor for Linux (Preview)
# Process Monitor for Linux (Preview) [![Build Status](https://oss-sysinternals.visualstudio.com/Procmon%20for%20Linux/_apis/build/status/microsoft.ProcMon-for-Linux?branchName=main)](https://oss-sysinternals.visualstudio.com/Procmon%20for%20Linux/_build/latest?definitionId=18&branchName=main)
Process Monitor (Procmon) is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.

![Procmon in use](procmon.gif "Procmon in use")
Expand All @@ -13,7 +13,7 @@ Process Monitor (Procmon) is a Linux reimagining of the classic Procmon tool fro


## Install Procmon
Checkout our [install instructions](INSTALL.md) for ditribution specific steps to install Procmon.
Checkout our [install instructions](INSTALL.md) for distribution specific steps to install Procmon.

## Building Procmon from source

Expand Down Expand Up @@ -105,4 +105,4 @@ Please see also our [Code of Conduct](CODE_OF_CONDUCT.md).
# License
Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.
Licensed under the MIT License.
9 changes: 6 additions & 3 deletions procmon.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.\" Manpage for procmon.
.TH man 8 "04/22/2020" "0.9" "procmon manpage"
.TH man 8 "07/16/2020" "0.1" "procmon manpage"
.SH NAME
procmon \- syscall tracing diagnostics tool
.SH SYNOPSIS
procmon [OPTIONS...]
-h Prints this help screen
-p/--pids Comma separated list of process ids to monitor
-h Prints this help screen
-p/--pids Comma separated list of process ids to monitor
-e/--events Comma separated list of system calls to monitor
-c/--collect [FILEPATH] Option to start Procmon in a headless mode
-f/--file FILEPATH Open a Procmon trace file
.SH DESCRIPTION
Procmon is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.
Binary file modified procmon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/common/cancellable_message_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ class CancellableMessageQueue
std::mutex writeLock;
std::mutex readLock;
std::condition_variable readCondition;
// TODO: should this be atomic?
std::atomic<bool> cancelled = false;

std::queue<T> leftQueue;
std::queue<T> rightQueue;
// TODO: Should these be atomic pointers instead?

std::queue<T> *currentWriteQueue = &leftQueue;
std::queue<T> *currentReadQueue = &rightQueue;

Expand Down
2 changes: 0 additions & 2 deletions src/common/cli_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ namespace CLIUtils
// re-enable cursor before exiting Procmon
system("setterm -cursor on");

// TODO: something better?
exit(-1);
}

// Prints usage string to terminal
void DisplayUsage(bool shouldExit)
{
// TODO
std::cout << "procmon [OPTIONS...]" << std::endl;
std::cout << " OPTIONS" << std::endl;
std::cout << " -h/--help Prints this help screen" << std::endl;
Expand Down
1 change: 0 additions & 1 deletion src/common/cli_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace CLIUtils
{
if (arg == NULL)
{
// TODO: real error logging
std::cerr << "ERROR: The argument '" << argName << "' cannot be null." << std::endl << std::endl;
DisplayUsage(true);
}
Expand Down
3 changes: 0 additions & 3 deletions src/common/stack_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ struct StackTrace

StackTrace() {}

// TODO use better serialization
// TODO throw exception on null/empty stack to serialize
std::string Serialize()
{
std::string ret;
Expand All @@ -32,7 +30,6 @@ struct StackTrace
return ret;
}

// TODO throw exception on null/empty stack trace to deserialize
void Inflate(std::string blob)
{
std::string token;
Expand Down
7 changes: 1 addition & 6 deletions src/configuration/procmon_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void ProcmonConfiguration::HandlePidArgs(char *pidArgs)
}
catch(const std::exception& e)
{
// TODO: Actual error handling
std::cerr << "ProcmonConfiguration::Invalid pid specified - " << e.what() << '\n';
CLIUtils::FastExit();
}
Expand All @@ -38,7 +37,6 @@ void ProcmonConfiguration::HandleStorageArgs(char *storageArgs)
}
else
{
// TODO: actual error handling...
std::cerr << "ProcmonConfiguration::\"" << storageArgs << "\" is not a valid storage engine" << std::endl;
CLIUtils::FastExit();
}
Expand Down Expand Up @@ -108,17 +106,14 @@ ProcmonConfiguration::ProcmonConfiguration(int argc, char *argv[])
CLIUtils::DisplayUsage(true);
break;
case 'p':
//CLIUtils::ProtectArgNotNull(optarg, "pids");
HandlePidArgs(optarg);
break;

case 's':
//CLIUtils::ProtectArgNotNull(optarg, "storageEngine");
HandleStorageArgs(optarg);
break;

case 'e':
//CLIUtils::ProtectArgNotNull(optarg, "events");
HandleEventArgs(optarg);
break;

Expand Down Expand Up @@ -186,7 +181,7 @@ ProcmonConfiguration::ProcmonConfiguration(int argc, char *argv[])
_tracerEngine->AddEvent(events);
_tracerEngine->AddPids(pids);

// TODO dynamically handle this based on architecture rather then current limit of x86_64
// List of all syscalls that contain pointer params
pointerSyscalls = ::SyscallSchema::Utils::Linux64PointerSycalls;
}

Expand Down
7 changes: 1 addition & 6 deletions src/configuration/procmon_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ struct ProcmonArgs
std::vector<pid_t> pids;
std::vector<Event> events;
StorageProxy::StorageEngineType storageEngineType;
// Other args
};

// Should only be created once. Pass around using
Expand Down Expand Up @@ -61,11 +60,7 @@ class ProcmonConfiguration : public ProcmonArgs
std::string ConvertEpocTime(time_t time);

public:
// TODO: What does every configuration need to have
// TODO: How do we map CLI args to fields here

// Initializes the configuration handling args
// and creating necessary resources.
// Initializes the configuration handling args and creating necessary resources.
ProcmonConfiguration(int argc, char *argv[]);

// Getters & Setters
Expand Down
2 changes: 0 additions & 2 deletions src/display/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void Column::addLine(std::string value)
this->currentLine++;
}

// TODO account for resizing columns by users i.e. use x param
int Column::resize(int height, int width, int x)
{
this->height = height;
Expand Down Expand Up @@ -96,7 +95,6 @@ void Column::redrawColumn()
}
}

// TODO: implement move logic once click support is implimented
void Column::moveColumn(int x)
{
this->x = x;
Expand Down
4 changes: 0 additions & 4 deletions src/display/event_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ std::string EventFormatter::DecodeArguments(ITelemetry event)
std::vector<struct SyscallSchema::SyscallSchema>& schema = config->GetSchema();

// Find the schema item
// TODO: We have to be smarted how we store the Syscall schema. Rather than a vector of SyscallSchema entries key off of the syscall ID for faster lookup.
int index = FindSyscall(event.syscall);
SyscallSchema::SyscallSchema item = schema[index];

Expand Down Expand Up @@ -175,9 +174,6 @@ std::string EventFormatter::DecodeArguments(ITelemetry event)

args+=" ";
}

// Once we complete the decoding of the arguments we can free the source buffer
// free(lineData.arguments); <--- I am going to leave this line here for a later conversation point with Mario

// now that we have the argument string for detail view we need to santize it for ASCII control characters
for(int i = 0; i < args.length(); i++)
Expand Down
26 changes: 2 additions & 24 deletions src/display/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include <thread>
#include <set>

// TODO setup color theme management
// TODO utilize column map to allow more easy customizability of visible columns

Screen::Screen()
{
totalLines = 0;
Expand Down Expand Up @@ -46,8 +43,7 @@ void Screen::InitializeFormatters()
void Screen::initScreen(std::shared_ptr<ProcmonConfiguration> config)
{
configPtr = config;
// TODO investigate automatic scrolling for a smoother UX i.e. scrollok()


InitializeFormatters();

root = initscr(); // start curses mode
Expand Down Expand Up @@ -81,7 +77,6 @@ void Screen::initScreen(std::shared_ptr<ProcmonConfiguration> config)

LOG(INFO) << "ScreenH:" << screenH << "ScreenW:" << screenW << "Column Height:" << columnHeight;

// TODO harden UI to detect if terminal supports colors and exit appropriately
// start initializing UI components
initHeader();
initFooter();
Expand Down Expand Up @@ -601,7 +596,7 @@ void Screen::shutdownScreen()

int Screen::getUserInput()
{
return wgetch(headerWin); // TODO investigate this to make sure it is dependable vs getch redrawing over all windows
return wgetch(headerWin);
}

void Screen::initColors()
Expand Down Expand Up @@ -934,7 +929,6 @@ void Screen::scrollDown()
// page down to scroll to next page if the current page is full
if(totalEvents == totalLines)
{
// TODO in the state machine refactor of the UI redo this logic
int oldPage = currentPage;
pageDown();

Expand Down Expand Up @@ -1072,7 +1066,6 @@ std::string Screen::DecodeArguments(ITelemetry event)
std::vector<struct SyscallSchema::SyscallSchema>& schema = config->GetSchema();

// Find the schema item
// TODO: We have to be smarted how we store the Syscall schema. Rather than a vector of SyscallSchema entries key off of the syscall ID for faster lookup.
int index = FindSyscall(event.syscall);
SyscallSchema::SyscallSchema item = schema[index];

Expand Down Expand Up @@ -1156,10 +1149,6 @@ std::string Screen::DecodeArguments(ITelemetry event)

args+=" ";
}

// Once we complete the decoding of the arguments we can free the source buffer
// free(lineData.arguments); <--- I am going to leave this line here for a later conversation point with Mario

return args;
}

Expand Down Expand Up @@ -1255,8 +1244,6 @@ void Screen::resize()
// get new terminal size
getmaxyx(stdscr, screenH, screenW);

// TODO error check for minimum terminal size needed

// calculate column height for initial screen size
columnHeight = screenH - HEADER_HEIGHT - FOOTER_HEIGHT;

Expand Down Expand Up @@ -1596,7 +1583,6 @@ void Screen::closeHelpView()
}


// TODO abstract all these views out to their own objects
void Screen::showDetailView()
{
int y = 1;
Expand Down Expand Up @@ -1806,16 +1792,8 @@ void Screen::handleMouseEvent(MEVENT* event)
setLineColor(currentLine, LINE_COLOR);
currentLine = event->y - pidColumn->getY();
setLineColor(currentLine, HIGHLIGHT_COLOR);

// was this a double click?
if(event->bstate == BUTTON1_DOUBLE_CLICKED)
{
// TODO open up detail view and display information on specific event for a double click
LOG(INFO) << "Double click at Y: " << event->y;
}
}
break;
// TODO is there anything we can do for a right click?

default:
LOG(INFO) << "Unknown mouse click";
Expand Down
5 changes: 0 additions & 5 deletions src/display/screen_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
#include <ncurses.h>
#include <math.h>

/*
* TODO:
* - manage import/export current screen config
* - default color management setup
*/
class ScreenConfiguration
{
public:
Expand Down
4 changes: 1 addition & 3 deletions src/procmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ int main(int argc, char *argv[])

/*
* Turn off cursor for shell. Note this has to be done before EBPF spins up.
* This is due to a conflict that leads to the consumer thread dieing when the sytem
* This is due to a conflict that leads to the consumer thread dieing when the system
* function is executed.
*/
system("setterm -cursor off");

// TODO properly configure logger rather then this basic config
// Configure logging
el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
el::Loggers::addFlag(el::LoggingFlag::AutoSpacing);
Expand All @@ -41,7 +40,6 @@ int main(int argc, char *argv[])
LOG(INFO) << "Tracing " << config->events.size() << " system calls";

// Configure logging
// TODO integrate into ProcmonConfiguration
el::Configurations defaultConf;
defaultConf.setToDefault();

Expand Down
1 change: 0 additions & 1 deletion src/storage/storage_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class StorageProxy
case StorageEngineType::Sql:
return new Sqlite3StorageEngine();
default:
// TODO: handle this error better...
return new MockStorageEngine();
}
};
Expand Down
1 change: 0 additions & 1 deletion src/storage/test_sqlite3_storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static std::vector<pid_t> pidRange(pid_t start, pid_t end)

static bool telemetryMatches(ITelemetry first, ITelemetry second)
{
// Todo(Jon): Need to add something for stack trace parameter once that becomes clear.
return first.comm == second.comm && first.syscall == second.syscall &&
first.pid == second.pid && first.processName == second.processName;
}
Expand Down
Loading

0 comments on commit 82ccfe2

Please sign in to comment.