egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Encrypting/Obfuscation

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
]Kami[
Owner


Joined: 24 Jul 2003
Posts: 590
Location: Slovenia

PostPosted: Wed Aug 04, 2004 3:14 pm    Post subject: Encrypting/Obfuscation Reply with quote

Hey,

I'm interested about encrypting tcl scripts or obfuscation.Yesterday i read every topic on egghelp about encrypting/obfuscation and also obfuscation site.I didn't really understand how to do it, but maybe some of you would be so kind and tell me how i can 'encrypt' scripts or how to use 'obfuscation'.I need it for my next script which source shouldn't be visible to public.I still didn't start to write script, because i don't know how i can 'encrypt' it later.

Tnx
_________________
Slovene Eggdrop Page
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Aug 04, 2004 3:56 pm    Post subject: Reply with quote

There's no way to create working code that can't be read by anyone. But you can scare off most people by using procomp to bytecode compile your script. (I would still be able to get your source ;P)
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Aug 04, 2004 3:58 pm    Post subject: Reply with quote

same goes with obfuscation.. it can easily be deobfuscated if you know where to look and to add Mr. Green
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Aug 04, 2004 4:00 pm    Post subject: Reply with quote

caesar wrote:
same goes with obfuscation.. it can easily be deobfuscated if you know where to look and to add Mr. Green

bytecode compilation IS obfuscation. Smile
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Aug 04, 2004 4:04 pm    Post subject: Reply with quote

oh.. lol.. I knew that.. Rolling Eyes Mr. Green
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
KrzychuG
Master


Joined: 16 Aug 2003
Posts: 306
Location: Torun, Poland

PostPosted: Wed Aug 04, 2004 4:12 pm    Post subject: Reply with quote

Quote:

There's no way to create working code that can't be read by anyone. But you can scare off most people by using procomp to bytecode compile your script. (I would still be able to get your source ;P)


I don't think so.
_________________
Que?
Back to top
View user's profile Send private message Visit poster's website
]Kami[
Owner


Joined: 24 Jul 2003
Posts: 590
Location: Slovenia

PostPosted: Wed Aug 04, 2004 4:23 pm    Post subject: Reply with quote

user wrote:
There's no way to create working code that can't be read by anyone. But you can scare off most people by using procomp to bytecode compile your script. (I would still be able to get your source ;P)


Just read the site and it looks ok, but i need something which doesn't need extra libary/file to be loaded...Just something which strikelight is using...I don't need it to be super encrypted, only something which will prevert newbies to view the source Smile Any idea, how i can use similar method like strikelight is using?
_________________
Slovene Eggdrop Page
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Aug 04, 2004 5:42 pm    Post subject: Reply with quote

The whole point of obfuscation is that people don't understand how it works, so posting a way to obfuscate kinda defeats its own purpose Razz If a method of obfuscation becomes widely used, the way to deobfuscate it will (sooner or later) become public knowledge too.
Code:
proc obfuscate code {
   foreach c [split $code ""] {set tmp($c) ""}
   set chrs [array names tmp]
   set i [array size tmp]
   set forward [set back [list]]
   foreach c $chrs {
      set r [expr {int(rand()*$i)}]
      incr i -1
      lappend forward $c [lindex $chrs $r]
      set back [concat [list [lindex $chrs $r] $c] $back]
      set chrs [lreplace $chrs $r $r]
   }
# EDIT 3: added this if
   if {rand()>0.5} {
      set cmd "if [expr {int(rand()*(1<<24))}]"
   } {
      set cmd eval
   }
   set code "[rndesc $cmd] \[[rndesc "string map"] [list $back [string map $forward $code]]\]"
}
proc obfuscateFile file {
   set f [open $file r+]
   puts $f [obfuscate [read $f][seek $f 0]]
   close $f
}
# EDIT 2: added this little sucker to hide the cleartext commands a bit :)
proc rndesc str {
   set o ""
   foreach c [split $str ""] {
      if {[string is space $c]} {append o $c} {
         append o [switch [expr {int(rand()*3)}] {
            0 {format \\%o [scan $c %c]}
            1 {format \\x%x [scan $c %c]}
            2 {format \\u%.4x [scan $c %c]}
         }]
      }
   }
   set o
}

Make sure you back up any file you want to try this on as i didn't test it much Razz

Btw: you can run it multiple times on the same file if you want to waste some more cpu loading the script.
_________________
Have you ever read "The Manual"?


Last edited by user on Fri Aug 06, 2004 11:52 am; edited 5 times in total
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Aug 05, 2004 10:49 am    Post subject: Reply with quote

KrzychuG wrote:
I don't think so.

What?
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
KrzychuG
Master


Joined: 16 Aug 2003
Posts: 306
Location: Torun, Poland

PostPosted: Thu Aug 05, 2004 11:45 am    Post subject: Reply with quote

I don't think you can retrieve source code from compiled tcl files.
_________________
Que?
Back to top
View user's profile Send private message Visit poster's website
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Aug 05, 2004 6:19 pm    Post subject: Reply with quote

KrzychuG wrote:
I don't think you can retrieve source code from compiled tcl files.

should I care? Rolling Eyes

Just because you failed doesn't mean it's impossible. I won't give you my decompiler, so you better start coding your own (just start reading the tbc loader source and get to know the format, and you should be able to make your own decompiler in a couple of evenings) or rewrite those scripts you claim to have lost. Wink
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
KrzychuG
Master


Joined: 16 Aug 2003
Posts: 306
Location: Torun, Poland

PostPosted: Thu Aug 05, 2004 7:06 pm    Post subject: Reply with quote

I rewrote them already Smile
Btw, can you give me some advices about tcl pro decompiler?
_________________
Que?
Back to top
View user's profile Send private message Visit poster's website
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Aug 05, 2004 7:30 pm    Post subject: Reply with quote

Advice 1: Be more specific
Advice 2: Stay focused when reading the source and take notes Razz

As I don't know C, my decompiler is 100% tcl (which is sort of weird, sure Razz) it has a call stack emulator that actually "runs" the bytecode. (the only way to do it i guess)
But if you're doing it in C, I think there's lots of stuff to cut'n'paste from where the error messages are generated (it will generate the source for a small part of the bytecode where the error occured (iirc))
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber