Register - Login
Views: 99393147
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
04-24-22 10:20:59 AM
Jul - Computers and Technology - Someone might find this interesting... New poll - New thread - New reply
Next newer thread | Next older thread
buphomet

Paragoomba
Level: 17


Posts: 66/74
EXP: 20654
For next: 4089

Since: 06-06-19

Pronouns: him/they

Since last post: 2.7 years
Last activity: 2.7 years

Posted on 07-24-19 04:22:26 PM (last edited by buphomet at 08-04-19 04:59:56 PM) Link | Quote
There exists a keylogger(not exactly the one of the best projects out there) and will routinely get associated with malicious activity but modifying this keylogger to make it function as would be good for me is my aim. My aim is not to log my keys but to record all keypresses into a database possibly accompanied by the time of keyboard activity. This can later be posted to a server, displayed graphically etc.

You can take a look at the already existing keylogger here logkeys . There is this piece of code that struck me as interesting. Declaring variables *within* a switch case.




case FLAG_POST_IRC: {
// optarg string should be like "entity@server:port", now dissect it
char *main_sep = strrchr(optarg, '@')
char *port_sep = strrchr(optarg, ':')
if (main_sep == NULL || port_sep == NULL)
error(EXIT_FAILURE, 0, "Invalid IRC FORMAT! Must be: nick_or_channel@server:port. See manual!")
*main_sep = '\0'; // replace @ with \0 to have entity string that starts at optarg
*port_sep = '\0'; // replace : with \0 to have server string that starts at main_sep+1
args.irc_entity = optarg;
args.irc_server = main_sep + 1;
args.irc_port = port_sep + 1;
break;
}

case FLAG_POST_SIZE:
args.post_size = atoi(optarg)
switch (optarg[strlen(optarg) - 1]) // process any trailing M(egabytes) or K(ilobytes)
{
case 'K': case 'k': args.post_size *= 1000; break;
case 'M': case 'm': args.post_size *= 1000000; break;
}
}
break;




Apparently, it should be possible to declare variables within the bounds to the braces.

Interesting enough to be worth posting here, at least to me.
InvisibleUp

Koopa
Level: 20


Posts: 31/104
EXP: 36266
For next: 6173

Since: 02-10-19

Pronouns: she/her

Since last post: 69 days
Last activity: 1 day

Posted on 07-24-19 09:43:56 PM Link | Quote
There's a thing like that for mouse movements called IOGraphica.

And re: the braces, you can put them anywhere and it expands the stack so you can put more variables in, and takes them out of scope at the end. In switch cases, in the middle of a function, it doesn't matter. It's neat for C89 programs where you can only declare variables right after an opening brace.

____________________
buphomet

Paragoomba
Level: 17


Posts: 67/74
EXP: 20654
For next: 4089

Since: 06-06-19

Pronouns: him/they

Since last post: 2.7 years
Last activity: 2.7 years

Posted on 07-25-19 05:45:14 AM (last edited by buphomet at 07-25-19 06:14:39 AM) Link | Quote
Originally posted by InvisibleUp


There's a thing like that for mouse movements called IOGraphica.




That is really decent. At first, Java put me off from trying out the project as my experience with Java is between very low to almost zero but ended up trying it out anyway

Originally posted by InvisibleUp


And re: the braces, you can put them anywhere and it expands the stack so you can put more variables in, and takes them out of scope at the end. In switch cases, in the middle of a function, it doesn't matter.




Thanks for reminding me about the braces. It sounds like something that has been read by me somewhere but not writing code means you easily forget such.

Originally posted by InvisibleUp


It's neat for C89 programs where you can only declare variables right after an opening brace.




Why not just declare your variables right after the opening brace? So as not to end up having too many variables littered in the code? The only way this would be useful, IMHO is if you want the variables to go out of scope after the closing brace otherwise you can always declare your variables after the opening brace, no?


Next newer thread | Next older thread
Jul - Computers and Technology - Someone might find this interesting... New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

29 database queries, 1 query cache hits.
Query execution time:  0.079907 seconds
Script execution time:  0.008065 seconds
Total render time:  0.087973 seconds


TidyHTML vomit below
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 2 column 301 - Warning: unescaped & or unknown entity "&page"
line 119 column 11 - Warning: <form> isn't allowed in <table> elements
line 118 column 10 - Info: <table> previously mentioned
line 120 column 11 - Warning: missing <tr>
line 120 column 119 - Warning: missing </font> before </td>
line 124 column 16 - Warning: plain text isn't allowed in <tr> elements
line 120 column 11 - Info: <tr> previously mentioned
line 125 column 68 - Warning: missing </nobr> before </td>
line 141 column 68 - Warning: missing </nobr> before <tr>
line 147 column 35 - Warning: missing <tr>
line 147 column 50 - Warning: missing </font> before </td>
line 148 column 37 - Warning: unescaped & or unknown entity "&id"
line 147 column 211 - Warning: missing </font> before </table>
line 149 column 35 - Warning: missing <tr>
line 149 column 50 - Warning: missing </font> before </td>
line 149 column 91 - Warning: missing </font> before </table>
line 156 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 158 column 9 - Warning: missing <tr>
line 176 column 13 - Warning: missing <tr>
line 177 column 102 - Warning: unescaped & or unknown entity "&postid"
line 216 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 218 column 9 - Warning: missing <tr>
line 236 column 13 - Warning: missing <tr>
line 237 column 102 - Warning: unescaped & or unknown entity "&postid"
line 239 column 74 - Warning: <style> isn't allowed in <td> elements
line 239 column 9 - Info: <td> previously mentioned
line 241 column 1508 - Warning: discarding unexpected </a>
line 244 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 246 column 9 - Warning: missing <tr>
line 264 column 13 - Warning: missing <tr>
line 265 column 102 - Warning: unescaped & or unknown entity "&postid"
line 295 column 17 - Warning: missing <tr>
line 295 column 17 - Warning: discarding unexpected <table>
line 298 column 35 - Warning: missing <tr>
line 298 column 50 - Warning: missing </font> before </td>
line 298 column 91 - Warning: missing </font> before </table>
line 300 column 35 - Warning: missing <tr>
line 300 column 50 - Warning: missing </font> before </td>
line 301 column 37 - Warning: unescaped & or unknown entity "&id"
line 300 column 211 - Warning: missing </font> before </table>
line 302 column 17 - Warning: discarding unexpected </textarea>
line 302 column 28 - Warning: discarding unexpected </form>
line 302 column 35 - Warning: discarding unexpected </embed>
line 302 column 43 - Warning: discarding unexpected </noembed>
line 302 column 53 - Warning: discarding unexpected </noscript>
line 302 column 64 - Warning: discarding unexpected </noembed>
line 302 column 74 - Warning: discarding unexpected </embed>
line 302 column 82 - Warning: discarding unexpected </table>
line 302 column 90 - Warning: discarding unexpected </table>
line 304 column 9 - Warning: missing </font> before <table>
line 316 column 25 - Warning: discarding unexpected </font>
line 325 column 57 - Warning: discarding unexpected </font>
line 303 column 1 - Warning: missing </center>
line 120 column 63 - Warning: <img> lacks "alt" attribute
line 125 column 19 - Warning: <td> attribute "width" has invalid value "120px"
line 125 column 93 - Warning: <img> lacks "alt" attribute
line 141 column 19 - Warning: <td> attribute "width" has invalid value "120px"
line 141 column 98 - Warning: <img> lacks "alt" attribute
line 148 column 44 - Warning: <img> proprietary attribute value "absmiddle"
line 148 column 142 - Warning: <img> proprietary attribute value "absmiddle"
line 148 column 246 - Warning: <img> proprietary attribute value "absmiddle"
line 160 column 11 - Warning: <img> lacks "alt" attribute
line 161 column 22 - Warning: <img> lacks "alt" attribute
line 161 column 63 - Warning: <img> lacks "alt" attribute
line 161 column 111 - Warning: <img> lacks "alt" attribute
line 161 column 161 - Warning: <img> lacks "alt" attribute
line 162 column 11 - Warning: <img> lacks "alt" attribute
line 172 column 15 - Warning: <img> lacks "alt" attribute
line 220 column 11 - Warning: <img> lacks "alt" attribute
line 221 column 22 - Warning: <img> lacks "alt" attribute
line 221 column 63 - Warning: <img> lacks "alt" attribute
line 221 column 111 - Warning: <img> lacks "alt" attribute
line 221 column 161 - Warning: <img> lacks "alt" attribute
line 222 column 11 - Warning: <img> lacks "alt" attribute
line 232 column 15 - Warning: <img> lacks "alt" attribute
line 248 column 11 - Warning: <img> lacks "alt" attribute
line 249 column 22 - Warning: <img> lacks "alt" attribute
line 249 column 63 - Warning: <img> lacks "alt" attribute
line 249 column 111 - Warning: <img> lacks "alt" attribute
line 249 column 161 - Warning: <img> lacks "alt" attribute
line 250 column 11 - Warning: <img> lacks "alt" attribute
line 260 column 15 - Warning: <img> lacks "alt" attribute
line 301 column 44 - Warning: <img> proprietary attribute value "absmiddle"
line 301 column 142 - Warning: <img> proprietary attribute value "absmiddle"
line 301 column 246 - Warning: <img> proprietary attribute value "absmiddle"
line 310 column 25 - Warning: <img> lacks "alt" attribute
line 315 column 267 - Warning: <img> lacks "alt" attribute
line 149 column 50 - Warning: trimming empty <font>
line 295 column 17 - Warning: trimming empty <tr>
line 298 column 50 - Warning: trimming empty <font>
line 125 column 68 - Warning: <nobr> is not approved by W3C
line 141 column 68 - Warning: <nobr> is not approved by W3C
line 177 column 27 - Warning: <nobr> is not approved by W3C
line 237 column 27 - Warning: <nobr> is not approved by W3C
line 265 column 27 - Warning: <nobr> is not approved by W3C
Info: Document content looks like HTML5
Info: No system identifier in emitted doctype
Tidy found 93 warnings and 0 errors!


The alt attribute should be used to give a short description
of an image; longer descriptions should be given with the
longdesc attribute which takes a URL linked to the description.
These measures are needed for people using non-graphical browsers.

For further advice on how to make your pages accessible
see http://www.w3.org/WAI/GL.
You are recommended to use CSS to specify the font and
properties such as its size and color. This will reduce
the size of HTML files and make them easier to maintain
compared with using <FONT> elements.

You are recommended to use CSS to control line wrapping.
Use "white-space: nowrap" to inhibit wrapping in place
of inserting <NOBR>...</NOBR> into the markup.

About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium

Do you speak a language other than English, or a different variant of
English? Consider helping us to localize HTML Tidy. For details please see
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md