def setup(): child = cmd_stat.gitclone(url_dir, git_repo, cmd_dir) if child != 0: return child dock_cat.cmd_cat(cmd_bin, 'cd ', cmd_dir, cmd_src) os.chdir(cmd_dir) print styles.ColorFormat.BLUE + "Running ./setup..." + styles.ColorFormat.RESET cmd_stat.exitcode('./setup.py') # Needs to be run first time to agree the license # And create '/etc/setoolkit/': print styles.ColorFormat.BLUE + "Running 'sudo ./setoolkit' for the first time (needed for configuration)..." + styles.ColorFormat.RESET cmd_stat.exitcode(cmd_src) print styles.ColorFormat.BLUE + "Connecting the Metasploit-framework to Social-engineer-toolkit" print "by adding METASPLOIT_PATH to /etc/setoolkit/set.config." print "Please type your root password:" + styles.ColorFormat.RESET sudo = 'sudo' find = 'METASPLOIT_PATH=.*' change = 'METASPLOIT_PATH=\/usr\/local\/share\/metasploit-framework' find1 = 'SENDMAIL=OFF' change1 = 'SENDMAIL=ON' filepath = '/etc/setoolkit/set.config' child = cmd_stat.find_and_change(sudo, find, change, filepath) child = cmd_stat.find_and_change(sudo, find1, change1, filepath) return child
def setup(): exist_bin = cmd_stat.exitcode('which -s ettercap') if exist_bin != 0: e = 'ettercap --with-ghostscript --with-gtk+ --with-ipv6 --with-luajit' child = cmd_stat.exitcode('brew install %s' % e) return child else: return exist_bin
def setup(): child = 0 if not exists_app: print styles.ColorFormat.YELLOW + "VLC player is not installed" + styles.ColorFormat.RESET print styles.ColorFormat.BLUE + "Installing VLC with brew cask:" + styles.ColorFormat.RESET child = cmd_stat.exitcode('brew cask install vlc') if child != 0: print styles.ColorFormat.RED + "something went wrong..." + styles.ColorFormat.RESET return child
def check_seticon(): exist_seticon_bin = os.path.exists(cmd_bin) if not exist_seticon_bin: cmd_stat.gitclone(url_dir, git_repo, cmd_dir) child = cmd_stat.exitcode('ln -s %s/seticon.sh %s' % (cmd_dir, cmd_bin)) if child == 0: print styles.ColorFormat.GREEN + "symlink '%s/bin/seticon' WAS CREATED!" % home + styles.ColorFormat.RESET else: print styles.ColorFormat.RED + "'%s/bin/seticon' symlink creation FAILED!" % home + styles.ColorFormat.RESET else: print styles.ColorFormat.YELLOW + "'seticon' command already exists" + styles.ColorFormat.RESET
def dock(dock_part, icns_path, cmd_app): # dock_part = 'others' | 'apps' # cmd_app | cmd_bin # if dock_part == 'others': seticon.check_seticon() # Set icon to script: cmd_stat.exitcode('seticon %s %s' % (icns_path, cmd_app)) elif dock_part == 'apps': pass else: print styles.ColorFormat.RED + "first argument in dock_cat.dock() function should be" print "either 'others' or 'apps'" print "Dock setup FAILED" + styles.ColorFormat.RESET return 1 # All dock settings are in: #/System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist # Adding script to Dock: #cmd_dock = "defaults write com.apple.dock persistent-%s -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>%s</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'" % (dock_part, cmd_app) cmd_dock = [ 'defaults', 'write', 'com.apple.dock', 'persistent-%s' % dock_part, '-array-add', '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>%s</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' % cmd_app ] cmd_stat.exitcode(cmd_dock) cmd_stat.exitcode('killall -HUP Dock') print styles.ColorFormat.GREEN + "Dock icons setup!" + styles.ColorFormat.RESET return 0
def cmd_cat(cmd_arg1, cmd_arg2, cmd_arg3, cmd_arg4): # USUALLY: # cmd_arg1 = cmd_app | cmd_bin # cmd_arg2 = 'cd '(with space after 'cd') | '' # cmd_arg3 = cmd_dir | '' # cmd_arg4 = cmd_src # exists_tgt = os.path.exists(cmd_arg1) if not exists_tgt: child = sp.Popen(cmd_cat_cd % (cmd_arg1, cmd_arg2, cmd_arg3, cmd_arg4), shell=True) child.wait() if child.returncode != 0: print styles.ColorFormat.RED + "%s: cmd_cat function FAILED!" % child.returncode + styles.ColorFormat.RESET return child.returncode else: print styles.ColorFormat.YELLOW + "%s already exists!" % cmd_arg1 + styles.ColorFormat.RESET child = cmd_stat.exitcode('chmod +x %s' % cmd_arg1) return child
def setup(): cmd_stat.gitclone(url_dir, git_repo, cmd_dir) cmd_stat.exitcode('bash %s/zsh_setup.sh' % cmd_dir) cmd_stat.find_and_change('sudo', 'ZSH_THEME=.*', 'ZSH_THEME=\"kallisti\"', '%s/.zshrc' % home) cmd_stat.cat_lines('%s/.zshrc' % home, 'source %s/.scripts/shell/modules/env/env.sh' % home) return 0
def setup(): cmd_stat.gitclone(url_dir, git_repo, cmd_dir) cmd_stat.exitcode("bash %s/msf_rbenv_osx_install.sh -ir" % cmd_dir) return 0