Jump to content

Is there a better place to ask my question?


BDonTJ

Recommended Posts

There is a better way to ask your question.

You have posted a link, that refers to another link, that then has your question.

Why not repeat the question here so people don't have to follow the links?
(Many won't on principle - who knows what it links or redirects to?).

And please enclose the script in code tags. Use the <> symbol on the editor menu bar.
Any/all code posted on any forum should always be enclosed in tags.

Edited by nukecad
Link to post
Share on other sites

Hello.  :hello: 

Whilst 'messing about' with my old iMac recently, I discovered this script. What is it designed to 'do' on my iMac?
 

=
Hello.  :hello: 

Whilst 'messing about' with my old iMac recently, I discovered this script. What is it designed to 'do' on my iMac?

=
 
##
# Common setup for startup scripts.
##
# Copyright 1998-2002 Apple Computer, Inc.
##
 
#######################
# Configure the shell #
#######################
 
##
# Be strict
##
#set -e
set -u
 
##
# Set command search path
##
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices; export PATH
 
##
# Set the terminal mode
##
#if [ -x /usr/bin/tset ] && [ -f /usr/share/misc/termcap ]; then
#    TERM=$(tset - -Q); export TERM
#fi
 
####################
# Useful functions #
####################
 
##
# Determine if the network is up by looking for any non-loopback
# internet network interfaces.
##
CheckForNetwork()
{
    local test
 
    if [ -z "${NETWORKUP:=}" ]; then
test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
if [ "${test}" -gt 0 ]; then
   NETWORKUP="-YES-"
else
   NETWORKUP="-NO-"
fi
    fi
}
 
alias ConsoleMessage=echo
 
##
# Process management
##
GetPID ()
{
    local program="$1"
    local pidfile="${PIDFILE:=/var/run/${program}.pid}"
    local     pid=""
 
    if [ -f "${pidfile}" ]; then
pid=$(head -1 "${pidfile}")
if ! kill -0 "${pid}" 2> /dev/null; then
   echo "Bad pid file $pidfile; deleting."
   pid=""
   rm -f "${pidfile}"
fi
    fi
 
    if [ -n "${pid}" ]; then
echo "${pid}"
return 0
    else
return 1
    fi
}
 
##
# Generic action handler
##
RunService ()
{
    case $1 in 
      start  ) StartService   ;;
      stop   ) StopService    ;;
      restart) RestartService ;;
      *      ) echo "$0: unknown argument: $1";;
    esac
}
 


I hope this helps.

D.

 
 
Link to post
Share on other sites

As for your question itself, sorry I know nothing about mac OS, maybe someone else does and at least they can easily see it now.

I will say that it looks like a general header to set up the enviroment (pathnames, functions, variables, etc) to be used by a script. You would add the code that does the actual job after that header.
(or copy/paste that header to the start of your code).

The comment line "# Common setup for startup scripts" would support that it is just for setting up an initial enviroment.

As for each individual command/parameter syntax, that would be specific to the OS.

Edited by nukecad
Link to post
Share on other sites

2 hours ago, nukecad said:

As for your question itself, sorry I know nothing about mac OS, maybe someone else does and at least they can easily see it now.

I will say that it looks like a general header to set up the enviroment (pathnames, functions, variables, etc) to be used by a script. You would add the code that does the actual job after that header.
(or copy/paste that header to the start of your code).

The comment line "# Common setup for startup scripts" would support that it is just for setting up an initial enviroment.

As for each individual command/parameter syntax, that would be specific to the OS.

Thank you so much for taking the time and trouble to take a look. :)

There may be someone else reading the forum who will know the answer!

Link to post
Share on other sites

  • Staff

That is the rc.common script, which should be found here:

/etc/rc.common

This is a script that is no longer used on modern macOS, but it's still present. It can be a means for providing persistence to malware (malware can add malicious lines of code to this script). However, I've tested this on systems from 10.7 and up, and that no longer works. I have been unable to get custom code added to rc.common to actually run on those systems.

So, tl;dr: it's a normal file, and it cannot be used for malicious purposes on 10.7 and up.

Link to post
Share on other sites

On 5/15/2018 at 11:37 AM, BDonTJ said:

Hello. :)

This post should be self-explanatory!

https://www.bleepingcomputer.com/forums/t/677444/is-there-a-better-place-to-ask-my-question/#entry4495933

Any help/advice will be most welcome.

TIA

 

 

Hi

Here's the replacement link!   https://www.bleepingcomputer.com/forums/t/677410/scripts-can-anyone-here-understand-what-this-one-might-do/

HTH

D.

Link to post
Share on other sites

  • 3 weeks later...
On 5/19/2018 at 1:07 AM, dcollins said:

tl;dr means "Too long didn't read", and is usually followed by a short summary of the information around it

Thank you so much for so advising, Devin. ?

My apology for not acknowledging earlier.

D.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
Back to top
×
×
  • Create New...

Important Information

This site uses cookies - We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.