LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2019, 08:39 PM   #1
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Obsfuscate strings in the executable file


I'm writing a C code with sensitive text information on it, that can easily revealed through the Unix util "strings".

How can I obfuscate theses texts in the code?

I thought in a reversible cypher like rot13 but I would like to hear the more experienced fellows.

Cheers,
 
Old 07-18-2019, 09:57 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
From what I'm seeing on my google search: your idea is actually how it's done.
 
1 members found this post helpful.
Old 07-22-2019, 10:12 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,783

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by marozsas View Post
I'm writing a C code with sensitive text information on it
Code should not contain sensitive information. But if you do persist with this anyway,

Quote:
I thought in a reversible cypher like rot13 but I would like to hear the more experienced fellows.
The problem with rot13 is that the result will still be recognized as a string by the "strings" program. It would be better to use a transformation that changes the text into arbitrary bytes.
 
1 members found this post helpful.
Old 08-06-2019, 11:38 AM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by marozsas View Post
I'm writing a C code with sensitive text information on it, that can easily revealed through the Unix util "strings".

How can I obfuscate theses texts in the code?

I thought in a reversible cypher like rot13 but I would like to hear the more experienced fellows.

Cheers,
You could invert the bits in each character: "A" = 0x41 -> 0xBE == "some odd line drawing character (probably) when displayed". You'd have to define all of your "sensitive" text strings as arrays of hex values that are run through the inversion function before display. Seems like you'll want to write a standalone program to read the strings you wish to be shrouded in your program and returns the C-code needed to define the strings in your source code.

HTH...
 
Old 08-30-2019, 06:00 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
You could compress them, overkill maybe but quick and simple enough.
(I think zlib is used in the kernel?)

https://www.zlib.net/manual.html#Utility
 
  


Reply

Tags
c code, obfuscate



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
replace strings in a file using strings from another file xpto09 Linux - Newbie 3 01-28-2016 06:11 PM
BASH: replace strings in on file by the strings in another one cristalp Programming 5 10-28-2011 09:47 AM
[SOLVED] Searching and replacing strings in a file with strings in other files xndd Linux - Newbie 16 07-29-2010 02:40 PM
Edit executable strings, like reshacker does on W32 nekkro-kvlt Programming 2 05-19-2009 04:37 PM
how to find duplicate strings in vertical column of strings markhod Programming 7 11-02-2005 04:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration