Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.56 KB

CONTRIBUTING.md

File metadata and controls

71 lines (50 loc) · 2.56 KB

Bashfuscator Contribution Guide

Style Guide

Bashfuscator conforms to the PEP8 standard except for a few key differences:

  1. Class, function and variable names are camelCase, with class names starting with an uppercase letter. Constant variables are named the normal way, all uppercase with an '_' separating words in the name.

  2. Four spaces should be used for indentation instead of tabs.

Other miscellaneous style rules to follow:

  • Always put whitespace between assignment, binary, comparison and Boolean operators:
self.payload += "cat '" + self.workingDir + "'/" + "?" * cmdLogLen + ";"     #good

self.payload+="cat '"+self.workingDir+"'/"+"?"*cmdLogLen+";"                 #not preferred
  • Always put a blank line before the return statement of any returning function:
def getPrefRange(self, pref):
        if pref == 0:
            min = max = 1
        elif pref == 1:
            min = 1
            max = 2
        elif pref < 4:
            min = 1
            max = pref + 2
        else:
            min = max = 5

        return (min, max)       #notice the blank line before the return
  • Always put a space before and after parameters when passing multiple parameters to a function:
prefStubs = self.getPrefItems(prefStubs, sizePref, timePref)    #good
prefStubs = self.getPrefItems(prefStubs,sizePref,timePref)      #not preferred
  • Use double quotes for string whenever possible. Single quoted strings are acceptable if the string contains double quotes inside of it:
if userOb.split("/")[0] == "command":                           #good
if userOb.split('/')[0] == 'command':                           #not preferred

self.payload += 'printf -- "\\x$(printf \'' + randomString      #ok, string contains double quotes
  • When adding imports to files, make sure the imports are alphabetical, and when possible import only what functions and classes that are needed.
import binascii
from sys import exit        #good
exit(0)

import sys                  #only needed to import sys.exit
import binascii             #not in alphabetical order
sys.exit(0)

Git Guidelines

  • Commit early and often. More numerous, smaller commits are prefered to few large ones.
  • Write meaningful commit messages. 'Misc tweaks' doesn't describe what was changed at all. When someone needs to go back and find that one commit that broke things, meaningful commit names make the process much less painful.
  • Try to accomplish one main thing in each commit. Don't try to fix 5 issues in one commit, or add 3 features either.