473,670 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding ascii text in memcpy?

Hi,

Is possible that memcpy can be used to hide const string value?

D
Jul 23 '05 #1
4 2051
Dave wrote:
Hi,

Is possible that memcpy can be used to hide const string value?


You're going to have to tell us more about what you consider "hiding".

Jacques.
Jul 23 '05 #2
Jacques Labuschagne wrote:
Dave wrote:
Hi,

Is possible that memcpy can be used to hide const string value?

You're going to have to tell us more about what you consider "hiding".

After the program is compiled, the assign valued of a string object
still can be viewed by some binary decoder eg. a strings program in Unix.

I m wondering if I can avoid the value of a string be seen by this kind
of tool if I use memcpy.

D
Jacques.

Jul 23 '05 #3
Dave wrote:
After the program is compiled, the assign valued of a string object
still can be viewed by some binary decoder eg. a strings program in Unix.

I m wondering if I can avoid the value of a string be seen by this kind
of tool if I use memcpy.


There's nothing special about memcpy, it just copies bytes from A to B.
You can always break your string up into several little pieces and then
reassemble it by hand...

For example, with the following:

#include <iostream>
using namespace std;

int main(){
cout << "Hi!" << endl;
}

I can see "Hi!" lurking in the binary;

00000940 55 89 e5 53 e8 00 00 00 00 5b 81 c3 ff 11 00 00
|U..S.....[......|
00000950 50 e8 de fc ff ff 59 5b c9 c3 00 00 03 00 00 00
|P.....Y[........|
00000960 01 00 02 00 48 69 21 00 01 1b 03 3b 30 00 00 00
|....Hi!....;0. ..|
00000970 05 00 00 00 2c fd ff ff 50 00 00 00 28 fe ff ff
|....,...P...(. ..|
00000980 6c 00 00 00 86 fe ff ff 8c 00 00 00 c4 fe ff ff
|l............. ..|

But with the following, (which gives exactly the same output), I don't:

#include <iostream>
using namespace std;

int main(){
char H = 0x10;
H<<=2;
H|=0x08;
char i = 0x60;
i|=0x08;
++i;
cout << H << i << "!" << endl;
}

Of course, this requires some assumptions about the character set you're
using. I know my machine's on ISO-8859-1, so I can use the character
codes for 'H' and 'i' to create the right glyphs.

If the string ever appears as a literal then it'll show up in the
binary. (Unless you're using a deathstation 9000, maybe.) The only way
to get around this is to avoid using nice complete literals like that.

Happy obfuscating,
Jacques.
Jul 23 '05 #4
On Thu, 26 May 2005 17:30:13 +0800, Dave <ro**@localhost .com> wrote:
Jacques Labuschagne wrote:
Dave wrote:
Hi,

Is possible that memcpy can be used to hide const string value?

You're going to have to tell us more about what you consider "hiding".

After the program is compiled, the assign valued of a string object
still can be viewed by some binary decoder eg. a strings program in Unix.

I m wondering if I can avoid the value of a string be seen by this kind
of tool if I use memcpy.

D
Jacques.


Another suggestion: don't have the actual strings in your compiled
program, put encrypted copies in your source code. Include a
decryption function in your program to decrypt the strings before you
use them.

e.g. Source code:

string mySecretMessage = "Khoor Zruog";
string myRealMessage = Decrypt(mySecre tMessage);
DoSomeWork(myRe alMessage);

The decryption function just replaces each character with the one
three places earlier in the alphabet. The real text of the message
will only exist at runtime, and will not be present in the executable
file on disk.

HTH

rossum
The ultimate truth is that there is no ultimate truth
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
542
by: DraguVaso | last post by:
Hi, For my SMS-application I need to be able to send characters with accents (like é and à). But this doesn't seem to work in Text Mode, so i will need to do it in PDU Mode. Does anybody has soem converting routines for that in VB.NET? I need my text to be converted to a PDU-message, and back (for received messages). Thansk in advance,
6
2931
by: myhotline | last post by:
hi all im very confused about using memcpy and i have three questions....memcpy takes a pointer to src and a pointer to dest and copies src to destination...but im very confuzed about when to use '&' operator while using memcpy....i have code that use '&' and the code that call memcpy without '&' like is the following same Quest1 ---
5
15036
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem occurs. The file contains characters with ASCII codes above 128. But the file is still text (nothing like UTF7/8 or the like). It also might contain + signs. As a result:
18
34117
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found Encoding.Convert, but that needs byte arrays. Thanks, /Ger
31
3144
by: Claude Yih | last post by:
Hi, everyone. I got a question. How can I identify whether a file is a binary file or an ascii text file? For instance, I wrote a piece of code and saved as "Test.c". I knew it was an ascii text file. Then after compilation, I got a "Test" file and it was a binary executable file. The problem is, I know the type of those two files in my mind because I executed the process of compilation, but how can I make the computer know the type of a...
6
8639
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii chars. i'm assuming python has something like valid_str = strip(invalid_str)
19
11402
by: Serman D. | last post by:
Hi, I have very limited C knowledge. I want to convert to output from a MD5 hash algorithm to printable ascii similar to the output of the md5sum in GNU coreutils. Any help on how to do the conversion is appreciated. $ gcc -o test test.c md5.c $ ./test "J?n??CBW? ?}"
11
4931
by: JJ297 | last post by:
I want to hide the Pin field below in my repeater. How do I do this? <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <tr> <td><font color="#330099">Claim SSN: </font><b><%# Eval("ClaimSSN") %></b></td> <td colspan="2"></td>
16
2513
by: rahul | last post by:
void foo(void) { /* blah blah */ } char buf = {....}; memcpy( (void *)&foo, buf, sizeof buf); This thing is giving segmentation fault on RHEL 5/gcc 4.1. Is the text segment protected? I am assuming foo has enough space for buf.
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5686
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.