LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-16-2015, 06:19 PM   #16
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320

Editing
Quote:
Originally Posted by lolada6 View Post
Lets imagine there is a tool that do this :

Enter language code:

uarray = unique(array)

Enter wished appearance of entered language code:

QQ = WW(RR)

So what I want is to "cloak" a code and make sure it works properly like original code does. Basically change appearance of entered code.
The following is valid Python:

Code:
WWW = unique
RR = array
QQ = WW(RR)

Last edited by dugan; 06-16-2015 at 06:23 PM.
 
Old 06-16-2015, 06:45 PM   #17
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
What's the end goal of this exercise? To take an existing code, remove comments, and change variable and function names to make it difficult to interpret?

It sounds like you maybe want an obfuscation tool?
 
1 members found this post helpful.
Old 06-17-2015, 09:21 AM   #18
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
Obfuscation tool might be what I need.

Any guides for how to create it??

Last edited by lolada6; 06-18-2015 at 08:21 AM.
 
Old 06-17-2015, 09:41 AM   #19
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
There are plenty of ready-made obfuscation programs out there, just do a Google search.

A search for "python obfuscation" returns pyminifier, bitboost, and mnfy all on the first page. There are obfuscation programs for almost any language out there, you just need to search.
 
1 members found this post helpful.
Old 06-17-2015, 10:07 AM   #20
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
So with it you could do this to code:


m=
class Quitter(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.pack()
widget = Button(self, text='Quit', command=self.quit)
widget.pack(expand=YES, fill=BOTH, side=LEFT)
def quit(self):
ans = askokcancel('Verify exit', "Really quit?")
if ans: Frame.quit(self)
So insted of writing that code you can just write m.

Last edited by lolada6; 06-17-2015 at 10:39 AM.
 
Old 06-17-2015, 02:16 PM   #21
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by lolada6 View Post
So with it you could do this to code:


m=
class Quitter(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.pack()
widget = Button(self, text='Quit', command=self.quit)
widget.pack(expand=YES, fill=BOTH, side=LEFT)
def quit(self):
ans = askokcancel('Verify exit', "Really quit?")
if ans: Frame.quit(self)
So insted of writing that code you can just write m.
Not a Python person, but isn't this just the definition of a MACRO?

That's what I'm thinking you'd create enumerations and macros in C in one or more include files and then you'd have to #include that H file. Once you have it, you then can use your macros, declarations, and type defines. In fact, that's done in many architectures. For instance, variable types, people figure out what the size of an int and long are and then they do type defines to make uint8_t, uint16_t, uint32_t, and the signed equivalents.

This is all that you're wanting to do. And you can do that probably in any language. I know you can do this in C, C++, C#, Java, even Assembler, so I'd imagine that this is possible in Tcl, Python, very many other languages.

But I think you'd have to structure these macros differently so that the macro would adhere to the rules of the language, but then still be the same interface to the higher level user invoking it.
 
Old 06-17-2015, 02:47 PM   #22
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Why do you want to obfuscate the code? Wouldn't compiling it then running it through a decompiler give you suitably unreadable code? If not, then why bother anyhow?
 
Old 06-17-2015, 05:32 PM   #23
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
Not only that code needs to be unreadable it needs to be short (short like one symbol m,n,2,/,|...) and code needs to be possible to be copyed or writen in its shortened version.It needs to be compatible with any language.So I gues it needs to be language for itself.

Like I said Im a noob in programming but this is how I imagine compatibility of languanges.

our code is symbol Đ I gues there is no language with that symbol cuz of that I assume its compatible with other languages so dosent interfer with any other symbols of that languages

so in this case:
Đ=print "3) Multiplication"
print "4) Division"
print "5) Quit calculator.py"
print " "
Normal code(first part of programm):
#print what options you have
print "Welcome to calculator.py"

print "your options are:"
print " "
print "1) Addition"
print "2) Subtraction"
Our code(second and last part of programm):Đ

Complite code:
#print what options you have
print "Welcome to calculator.py"

print "your options are:"
print " "
print "1) Addition"
print "2) Subtraction"
Đ
Post is little confusing sorry for that. I hope you understood what I meant.

Last edited by lolada6; 06-18-2015 at 03:17 AM.
 
Old 06-17-2015, 10:43 PM   #24
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by lolada6 View Post
Not only that code needs to be unreadable it needs to be short (short like one symbol m,n,2,/,|...) and code needs to be possible to be copyed or writen in its shortened version.It needs to be compatible with any language.So I gues it needs to be language for itself.

Like I said Im a noob in programming but this is how I imagine compatibility of languanges
Pointless.

Unreadable code.

Why bother? Just to be "cool"?

Yes you are new to coding because one of the primary directives of a coder is to make readable, maintainable code.

As others are saying, obfuscation is not the right choice here.

And I've already pointed out that you can obfuscate in C already, but the intentions are not that you write code to as abstract what it really is doing and thus making it unreadable and non-maintainable.

What does one gain with compatibility of languages? What about portability instead?
 
Old 06-18-2015, 03:55 AM   #25
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
Its my language so I its readable and maintainable by me. In this case we dont need portability we need compatibility.

Question about obfuscation: We have 2 identical programms made by same language in 1st programm we obfuscate all codes of programm with some kind of obfuscation tool. So can we now copy that obfuscated code from 1st programm to 2nd programm or we must use obfuscation tool on that 2nd programm too??

Last edited by lolada6; 06-18-2015 at 08:18 AM.
 
Old 06-18-2015, 05:43 AM   #26
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by lolada6 View Post
or we must us obfuscation tool on that 2nd programm too??
Naturally.
 
Old 06-18-2015, 08:41 AM   #27
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
That settles it obfuscation is not what I need.
 
Old 06-18-2015, 09:02 AM   #28
lolada6
LQ Newbie
 
Registered: Jun 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled
It seems that only solution is creating part of custom programming language ie. one function.
And that functions result should be eg. 2+3=5 and our code loks like letter m

So when we are programming and we write m it will print 2+3=5

Any ideas for how to do that?
 
Old 06-18-2015, 09:10 AM   #29
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by lolada6 View Post
So when we are programming and we write m it will print 2+3=5

Any ideas for how to do that?
Code:
#define m (printf("2+3=5\n"))
 
Old 06-18-2015, 10:03 AM   #30
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by lolada6 View Post
Not only that code needs to be unreadable it needs to be short (short like one symbol m,n,2,/,|...) and code needs to be possible to be copyed or writen in its shortened version.
WHY?
You still haven't answered this very basic question.

What are you doing?
What is the end goal?
What is driving these requirements you keep posting?

Quote:
Originally Posted by lolada6 View Post
It needs to be compatible with any language.
WHAT needs to be compatible?

Are you inventing a language with which you can write programs, or a tool you can use to shorten the syntax and obfuscate existing programs in other languages, or a tool where you can write "pseudocode" and it will auto-generate code in a language you select???

Let me ask you this. When this exercise of yours is done, when you've hit that point where you pop the cork and have a drink because the work is over, what does the end result look like? What is it? What does it do? How do you use it? What do you use it for?

Quote:
Originally Posted by lolada6 View Post
It seems that only solution is creating part of custom programming language ie. one function.
And that functions result should be eg. 2+3=5 and our code loks like letter m

So when we are programming and we write m it will print 2+3=5

Any ideas for how to do that?
Look back at page 1. This thread has gone full circle.

Last edited by suicidaleggroll; 06-18-2015 at 10:05 AM.
 
  


Reply



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
qdvdauthor help creating a slideshow needed ssenuta Linux - Software 4 11-06-2020 11:30 AM
Help needed on Creating a remote server dprime Linux - Newbie 3 04-25-2010 11:23 AM
Looking For books About 64 bit Assembly Languange With Multicore btbx Linux - General 3 07-15-2008 04:24 PM
Help needed in creating a partition for freebsd qanopus *BSD 1 08-11-2004 03:20 PM

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

All times are GMT -5. The time now is 04:22 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