473,729 Members | 2,141 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 2055
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
2945
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
15043
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
34140
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
3213
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
8660
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
11421
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
4934
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
2517
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
8923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9151
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
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
6025
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
4529
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...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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
2686
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.