Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Open-source Keylogger

Hi guys,

Haven't posted in forever so I thought I might as well release this somewhere. I am busy working on an open-source keylogger in C++.

If anyone would like to have a look at it, fork it, or improve features please feel free.
GitHub Source

Enjoy 👍
http://en.cppreference.com/w/cpp/language/namespace

[warn]
Your GetOS function will not work reliably. I think you should read about the problems with GetVersionEx() ever since Windows 8/8.1/10... For what you're doing, there's a reason why Microsoft created a version API. You're also mixing ANSI with Unicode here, which is a very poor idea, and makes me think you took snippets from all over the place for these functions because you don't stay consistent.

(Jun 12, 2017 09:45 AM)morph Wrote:  http://en.cppreference.com/w/cpp/language/namespace

Providing a link by itself with no direction is hardly helpful. I would assume you're wanting him to look at the notes section about 'using namespace std'.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(Jun 12, 2017 10:56 AM)0xDEAD10CC Wrote:  Providing a link by itself with no direction is hardly helpful. I would assume you're wanting him to look at the notes section about 'using namespace std'.

Yes, sorry. I forgot to add that
(Jun 12, 2017 10:56 AM)0xDEAD10CC Wrote:  Your GetOS function will not work reliably...

Call the ntdll.dll equivalent of the function and it should work normally.
At least it did when I coded shit.
Saw a memory leak, instantly bad.
(Jun 12, 2017 11:46 PM)Hoodie+ Wrote:  Call the ntdll.dll equivalent of the function and it should work normally.
At least it did when I coded shit.

yes, RtlGetVersion works.

@OP
As touchmytralala stated you have a memleak:
https://github.com/TachyonRSA/Axonode/bl...il.cpp#L76
https://github.com/TachyonRSA/Axonode/bl...e.cpp#L101

Edit:
also here
https://github.com/TachyonRSA/Axonode/bl...l.cpp#L240
https://github.com/TachyonRSA/Axonode/bl...l.cpp#L279
https://github.com/TachyonRSA/Axonode/bl...l.cpp#L285

the pointer to the allocated memory buffer is not freed in any way
OP I suggest you to learn how pointers and memory allocation actually work
(Jun 13, 2017 09:24 AM)maldev0 Wrote:  yes, RtlGetVersionEx works.

@OP
As touchmytralala stated you have a memleak:
https://github.com/TachyonRSA/Axonode/bl...il.cpp#L76
https://github.com/TachyonRSA/Axonode/bl...e.cpp#L101

the pointer to the allocated memory buffer is not freed in any way

Omg he calls free after return xD
Dude please go back to books, you have mem leaks, you dont even use rval moves, you dont even know what ur doing.
Please learn what RAII/unique/shared ptr and how stuff is returned in C++ and what move semantics are before coding something.Whenever you make a function call you copy entire universe because u have 0 clue about anything beyond what WinAPI is. It's people like you who brought the quality of this section down to minecraft level
There is only C. Everything else is skid overhead.
Also 90% of this code is C, not C++, the only thing thats C++ is "cout"
There is only C. Everything else is skid overhead.
(Jun 13, 2017 12:43 PM)Rageline Wrote:  Also 90% of this code is C, not C++, the only thing thats C++ is "cout"

How'd you manage to doublepost between a few minutes? ❓
[Image: chain.png]
(Jun 13, 2017 02:54 PM)Sajuuk Wrote:  How'd you manage to doublepost between a few minutes? ❓

One guy with girl avatar removed his post inbetween
There is only C. Everything else is skid overhead.
(Jun 13, 2017 12:41 PM)Rageline Wrote:  Dude please go back to books, you have mem leaks, you dont even use rval moves, you dont even know what ur doing.
Please learn what RAII/unique/shared ptr and how stuff is returned in C++ and what move semantics are before coding something.Whenever you make a function call you copy entire universe because u have 0 clue about anything beyond what WinAPI is. It's people like you who brought the quality of this section down to minecraft level

"rvalue moves"
What are you talking about?
It's actually pretty rare outwith move constructors (and move assignment operators) or in template functions (universal references) that you'd actually have an rvalue reference parameter. That syntax only exists to lessen ambiguity between the const reference syntax (where you can pass in an rvalue, temporary, and it will assume the lifetime of the immutable reference it's bound to). rvalue references simply make something a candidate for moving. What do you mean by "rvalue moves"? Most moves in reality will simply consist of you using std::move when passing to a by-value parameter (and, in some cases, copy elision will be performed implicitly - especially in the case of "how stuff is returned in C++" where RVO will happen on move-only types (and in some other scenarios - read the spec regarding the "triviality" of copying/moving objects) implicitly; hence why unique_ptr factories such as make_unique need not std::move on their return).

I understand your logic behind wanting to introduce move semantics but, after a small look over the code, he's mostly passing around pointers and handles which have little overhead. I seen a case where he's passing a std::string by-value but, even in that scenario, introducing move operations will likely still have reasonable overhead when you consider SSO. A move on a std::string that has been optimised (where string content is on the stack) will have the same overhead as copying. So, he should prefer passing by const reference in such scenarios.

It is true though that he should probably manage a lot of his memory using a smart pointer like std::unique_ptr where moving is required but saying "rval moves" is just vague guidance for OP (and easy to misinterpret).

@OP - there is a few memory leaks in your code and areas where I'm concerned for your understand of C++. For example, in one scenario you use malloc() for the destination of GetWindowTextA and, in another, you use the new syntax. Make up your mind and make sure you used delete[] when freeing. You'd be better off using smart pointers and making using of the syntax introduced in C++14 for creating arrays w/ std::make_unique factory (e.g. std::make_unique<int[]>(length)) then just making sure the lifetime of this smart pointer object is adequate when you inevitably .get() the underlying raw pointer to use it with WinAPI.
Dostoevsky(const Dostoevsky&) = delete;
[Image: T4BXHDP.png]
(Jun 13, 2017 11:54 PM)Dostoevsky Wrote:  @OP - there is a few memory leaks in your code and areas where I'm concerned for your understand of C++. For example, in one scenario you use malloc() for the destination of GetWindowTextA and, in another, you use the new syntax. Make up your mind and make sure you used delete[] when freeing. You'd be better off using smart pointers and making using of the syntax introduced in C++14 for creating arrays w/ std::make_unique factory (e.g. std::make_unique<int[]>(length)) then just making sure the lifetime of this smart pointer object is adequate when you inevitably .get() the underlying raw pointer to use it with WinAPI.

This guy is a legend. Listen to him.
(Jun 13, 2017 11:54 PM)Dostoevsky Wrote:  "rvalue moves"
What are you talking about?
It's actually pretty rare outwith move constructors (and move assignment operators) or in template functions (universal references) that you'd actually have an rvalue reference parameter. That syntax only exists to lessen ambiguity between the const reference syntax (where you can pass in an rvalue, temporary, and it will assume the lifetime of the immutable reference it's bound to). rvalue references simply make something a candidate for moving. What do you mean by "rvalue moves"? Most moves in reality will simply consist of you using std::move when passing to a by-value parameter (and, in some cases, copy elision will be performed implicitly - especially in the case of "how stuff is returned in C++" where RVO will happen on move-only types (and in some other scenarios - read the spec regarding the "triviality" of copying/moving objects) implicitly; hence why unique_ptr factories such as make_unique need not std::move on their return).

I understand your logic behind wanting to introduce move semantics but, after a small look over the code, he's mostly passing around pointers and handles which have little overhead. I seen a case where he's passing a std::string by-value but, even in that scenario, introducing move operations will likely still have reasonable overhead when you consider SSO. A move on a std::string that has been optimised (where string content is on the stack) will have the same overhead as copying. So, he should prefer passing by const reference in such scenarios.

It is true though that he should probably manage a lot of his memory using a smart pointer like std::unique_ptr where moving is required but saying "rval moves" is just vague guidance for OP (and easy to misinterpret).

@OP - there is a few memory leaks in your code and areas where I'm concerned for your understand of C++. For example, in one scenario you use malloc() for the destination of GetWindowTextA and, in another, you use the new syntax. Make up your mind and make sure you used delete[] when freeing. You'd be better off using smart pointers and making using of the syntax introduced in C++14 for creating arrays w/ std::make_unique factory (e.g. std::make_unique<int[]>(length)) then just making sure the lifetime of this smart pointer object is adequate when you inevitably .get() the underlying raw pointer to use it with WinAPI.

ur right i could've written 500 words to OP what to do but when he would look at cppreference link of anything his brain would shut down permanently.
There is only C. Everything else is skid overhead.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by alizer0Jul 23, 2021 10:47 AM 2 422 Jul 23, 2021 10:47 AM
Last Post: tux1
[Python] by unixJul 11, 2020 10:36 PM 0 290 Jul 11, 2020 10:36 PM
Last Post: unix
[C#] by PaskowskyMar 27, 2019 06:22 PM 6 873 Mar 27, 2019 06:22 PM
Last Post: deiski