Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:49:30+00:00 2026-05-16T05:49:30+00:00

Some time ago, i wrote some bash scripts for my school. I thought it

  • 0

Some time ago, i wrote some bash scripts for my school. I thought it would be very clever to ‘protect’ them, so i compiled them with shc into a binary file. Some weeks later, i lost the uncompiled scripts and now i have only my binarys left.

Is there a way to retrieve the scripts back from the shc generated binarys? I looked into the source code of shc to find a way to decompile the binarys with no luck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:49:30+00:00Added an answer on May 16, 2026 at 5:49 am

    Using shc to compile your scripts does not protect them. You don’t get more security this way. The shc compiled binary decrypts and loads the script into memory when started. You could then, right after you started the binary, just segfault it and retrieve your script from the coredump.

    Here’s a little example script named test.sh:

    #! /bin/bash
    echo "starting script and doing stuff"
    sleep 1
    echo "finished doing stuff"
    

    Compile it with shc:

    shc -f test.sh
    

    Start it as background process and segfault it right away:

    ./test.sh.x&  ( sleep 0.2 && kill -SIGSEGV $! )
    

    sleep 0.2 will give the binary enough time to start up and decrypt the original script. The variable $! contains the pid of the last background process started, so we can easily kill it with the segmentation fault signal SIGSEGV (same as kill -11 $!).

    [1]  + segmentation fault (core dumped)  ./test.sh.x
    

    Now we can search the dump for the original script:

    cat core | strings
    

    We pipe the data in the dumpfile to strings, which will then show us all the printable characters in the file and we can now see the original script between the garbage:

    ...
    4.0.37(2)-release
    BASH_VERSINFO
    BASH_VERSINFO
    release
    i686-pc-linux-gnu
    BASH_EXECUTION_STRING
    BASH_EXECUTION_STRING
                               #! /bin/bash
    echo "starting script and doing stuff"
    sleep 1
    echo "finished doing stuff"
    1000
    EUID
    EUID
    1000
    ...
    

    If the script is pretty big, maybe you have to adjust the core file size with ulimit.
    Pretty easy, right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some time ago, I wrote some code to decide which method of updating mutable
Some time ago I created this LAMP based web. At the time I wrote
I've got a function I wrote quite some time ago that works fine, but
Some time ago I was asked the strange question how would I implement map
Some time ago, people here helped me very well with code. Now I'm tasked
I wrote a program some time ago (Mac OS X, C++, SDL, FMOD) and
So I'm working with some older code I wrote some time ago. I was
Some time ago i Wrote a service with a timer that make an action
I was tidying up some code I wrote a long time ago, putting it
Some time ago, I wrote a small app, which needs to create outbound phone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.