Skip to content

Commit

Permalink
Change preferred command from 'cc.py' to 'caringcaribou'
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkarlsson committed Mar 28, 2024
1 parent a38e1bc commit 545258c
Show file tree
Hide file tree
Showing 27 changed files with 226 additions and 226 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -9,7 +9,7 @@ Please open an issue with a high-level description of the change, to request fee

## Before submitting a Pull Request
* Make sure the PR only adds/changes/fixes a single thing
* Make sure the change does not break the test suite (by running `cc.py -i <INTERFACE> test`)
* Make sure the change does not break the test suite (by running `caringcaribou -i <INTERFACE> test`)
* Make sure the code adheres to [PEP - 8 (Style Guide for Python Code)](https://peps.python.org/pep-0008/)
* Avoid [magic numbers](https://en.wikipedia.org/wiki/Magic_number_(programming)) in the code when possible
* Avoid changes that break other users' setups (such as dropping currently supported Python versions or hardcoding values for your favorite ECU)
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -17,21 +17,21 @@ Install the tool:

The best way to understand how to use Caring Caribou is to look at the help screen:

cc.py --help
caringcaribou --help

This will list all available modules at the bottom of the output. Help for specific modules works the same way. For example, the help screen for the `send` module is shown by running

cc.py send --help
caringcaribou send --help

The module help always includes some usage examples. If the module has multiple sub functions, these have similar help screens as well:

cc.py send message -h
cc.py send file -h
caringcaribou send message -h
caringcaribou send file -h

More detailed usage information is available [in the documentation on usage](documentation/howtouse.md).

## Features and Architecture
Caring Caribou is based on a main entry point, `cc.py`, which runs the show. This enables an easy drop-in architecture for new modules, which are located in the `caringcaribou/modules` folder.
Caring Caribou is based on a main entry point in `caringcaribou.py` which runs the show. This enables an easy drop-in architecture for new modules, which are located in the `caringcaribou/modules` folder.

The `caringcaribou/utils` folder contains various higher level CAN protocol implementations and shared functions, meant to be used by modules.

Expand Down Expand Up @@ -141,9 +141,9 @@ Some sort of CAN bus interface (http://elinux.org/CAN_Bus#CAN_Support_in_Linux)
- Create a python file with a function `module_main(args)` (or copy the template) in the `caringcaribou/modules` directory.
- In `setup.py`, add an entry under `caringcaribou.modules`, referencing your new module like: `my_module = caringcaribou.modules.my_module`
- Run `python setup.py install`
- Verify that the module is available, should be listed in the output of `cc.py -h`
- Verify that the module is available, it should be listed in the output of `caringcaribou -h`

If your new module is located in `caringcaribou/modules/foo.py` you will run it with the command `cc.py foo`.
If your new module is located in `caringcaribou/modules/foo.py` you will run it with the command `caringcaribou foo`.
Additional arguments (if any) are passed as arguments to the `module_main` function.


Expand Down
2 changes: 1 addition & 1 deletion caringcaribou/caringcaribou.py
Expand Up @@ -10,7 +10,7 @@
import pkg_resources


VERSION = "0.5"
VERSION = "0.6"


def show_script_header():
Expand Down
16 changes: 8 additions & 8 deletions caringcaribou/modules/dcm.py
Expand Up @@ -425,17 +425,17 @@ def parse_args(args):
:return: Namespace containing action and action-specific arguments
:rtype: argparse.Namespace
"""
parser = argparse.ArgumentParser(prog="cc.py dcm",
parser = argparse.ArgumentParser(prog="caringcaribou dcm",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""Diagnostics module for CaringCaribou""",
epilog="""Example usage:
cc.py dcm discovery
cc.py dcm discovery -blacklist 0x123 0x456
cc.py dcm discovery -autoblacklist 10
cc.py dcm services 0x733 0x633
cc.py dcm subfunc 0x733 0x633 0x22 2 3
cc.py dcm dtc 0x7df 0x7e8
cc.py dcm testerpresent 0x733""")
caringcaribou dcm discovery
caringcaribou dcm discovery -blacklist 0x123 0x456
caringcaribou dcm discovery -autoblacklist 10
caringcaribou dcm services 0x733 0x633
caringcaribou dcm subfunc 0x733 0x633 0x22 2 3
caringcaribou dcm dtc 0x7df 0x7e8
caringcaribou dcm testerpresent 0x733""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
22 changes: 11 additions & 11 deletions caringcaribou/modules/doip.py
Expand Up @@ -707,21 +707,21 @@ def seed_randomness_fuzzer(args):
def __parse_args(args):
"""Parser for module arguments"""
parser = argparse.ArgumentParser(
prog="cc.py doip",
prog="caringcaribou doip",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="DoIP module for "
"CaringCaribou",
epilog="""Example usage:
cc.py doip discovery
cc.py doip discovery -blacklist 0x123 0x456
cc.py doip discovery -autoblacklist 10
cc.py doip services 0x733 0x633
cc.py doip ecu_reset 1 0x733 0x633
cc.py doip testerpresent 0x733
cc.py doip security_seed 0x3 0x1 0x733 0x633 -r 1 -d 0.5
cc.py doip dump_dids 0x733 0x633
cc.py doip dump_dids 0x733 0x633 --min_did 0x6300 --max_did 0x6fff -t 0.1
cc.py doip seed_randomness_fuzzer 2 2 0x733 0x633 -m 1 -t 10 -d 50 -id 4""")
caringcaribou doip discovery
caringcaribou doip discovery -blacklist 0x123 0x456
caringcaribou doip discovery -autoblacklist 10
caringcaribou doip services 0x733 0x633
caringcaribou doip ecu_reset 1 0x733 0x633
caringcaribou doip testerpresent 0x733
caringcaribou doip security_seed 0x3 0x1 0x733 0x633 -r 1 -d 0.5
caringcaribou doip dump_dids 0x733 0x633
caringcaribou doip dump_dids 0x733 0x633 --min_did 0x6300 --max_did 0x6fff -t 0.1
caringcaribou doip seed_randomness_fuzzer 2 2 0x733 0x633 -m 1 -t 10 -d 50 -id 4""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
10 changes: 5 additions & 5 deletions caringcaribou/modules/dump.py
Expand Up @@ -51,14 +51,14 @@ def parse_args(args):
:param args: List of arguments
:return: Argument namespace
"""
parser = argparse.ArgumentParser(prog="cc.py dump",
parser = argparse.ArgumentParser(prog="caringcaribou dump",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="CAN traffic dump module for CaringCaribou",
epilog="""Example usage:
cc.py dump
cc.py dump -s 1.0
cc.py dump -f output.txt
cc.py dump -c -f output.txt 0x733 0x734""")
caringcaribou dump
caringcaribou dump -s 1.0
caringcaribou dump -f output.txt
caringcaribou dump -c -f output.txt 0x733 0x734""")
parser.add_argument("-f", "--file",
metavar="F",
help="Write output to file F (default: stdout)")
Expand Down
16 changes: 8 additions & 8 deletions caringcaribou/modules/fuzzer.py
Expand Up @@ -703,17 +703,17 @@ def parse_args(args):
:rtype: argparse.Namespace
"""
global DELAY_BETWEEN_MESSAGES
parser = argparse.ArgumentParser(prog="cc.py fuzzer",
parser = argparse.ArgumentParser(prog="caringcaribou fuzzer",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Fuzzing module for CaringCaribou",
epilog="""Example usage:
./cc.py fuzzer random
./cc.py fuzzer random -min 4 -seed 0xabc123 -f log.txt
./cc.py fuzzer brute 0x123 12ab..78
./cc.py fuzzer mutate 7f.. 12ab....
./cc.py fuzzer replay log.txt
./cc.py fuzzer identify log.txt""")
caringcaribou fuzzer random
caringcaribou fuzzer random -min 4 -seed 0xabc123 -f log.txt
caringcaribou fuzzer brute 0x123 12ab..78
caringcaribou fuzzer mutate 7f.. 12ab....
caringcaribou fuzzer replay log.txt
caringcaribou fuzzer identify log.txt""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down Expand Up @@ -783,7 +783,7 @@ def module_main(arg_list):
"""
Fuzz module main wrapper.
:param arg_list: Module argument list passed by cc.py
:param arg_list: Module argument list passed by caringcaribou.py
"""
try:
# Parse arguments
Expand Down
2 changes: 1 addition & 1 deletion caringcaribou/modules/listener.py
Expand Up @@ -42,7 +42,7 @@ def parse_args(args):
:return: Argument namespace
:rtype: argparse.Namespace
"""
parser = argparse.ArgumentParser(prog="cc.py listener",
parser = argparse.ArgumentParser(prog="caringcaribou listener",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Passive listener module for CaringCaribou")
parser.add_argument("-r", "--reverse",
Expand Down
16 changes: 8 additions & 8 deletions caringcaribou/modules/module_template.py
Expand Up @@ -17,11 +17,11 @@
3. Run: `setup.py install`
4. Verify that the module is available,
it should be listed in the output of `cc.py -h`
it should be listed in the output of `caringcaribou -h`
5. Run the following command to run module and show usage instructions:
$ cc.py my_module -h
$ caringcaribou my_module -h
"""
from __future__ import print_function
import argparse
Expand Down Expand Up @@ -81,13 +81,13 @@ def parse_args(args):
:return: Argument namespace
:rtype: argparse.Namespace
"""
parser = argparse.ArgumentParser(prog="cc.py module_template",
parser = argparse.ArgumentParser(prog="caringcaribou module_template",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Descriptive message for the template module",
epilog="""Example usage:
cc.py module_template
cc.py module_template -id 123
cc.py module_template -id 0x1FF""")
caringcaribou module_template
caringcaribou module_template -id 123
caringcaribou module_template -id 0x1FF""")
parser.add_argument("-id", type=parse_int_dec_or_hex,
default=0, help="arbitration ID to use")
args = parser.parse_args(args)
Expand All @@ -96,9 +96,9 @@ def parse_args(args):

def module_main(arg_list):
"""
Module main wrapper. This is the entry point of the module when called by cc.py
Module main wrapper. This is the entry point of the module when called by caringcaribou
:param arg_list: Module argument list passed by cc.py
:param arg_list: Module argument list passed by caringcaribou
"""
try:
# Parse arguments
Expand Down
12 changes: 6 additions & 6 deletions caringcaribou/modules/send.py
Expand Up @@ -227,16 +227,16 @@ def parse_args(args):
:return: Argument namespace
:rtype: argparse.Namespace
"""
parser = argparse.ArgumentParser(prog="cc.py send",
parser = argparse.ArgumentParser(prog="caringcaribou send",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Raw message transmission module for CaringCaribou.\n"
"Messages can be passed as command line arguments or through a file.",
epilog="""Example usage:
cc.py send message 0x7a0#c0.ff.ee.00.11.22.33.44
cc.py send message -d 0.5 123#de.ad.be.ef 124#01.23.45
cc.py send message -p 0x100#11 0x100#22.33
cc.py send file can_dump.txt
cc.py send file -d 0.2 can_dump.txt""")
caringcaribou send message 0x7a0#c0.ff.ee.00.11.22.33.44
caringcaribou send message -d 0.5 123#de.ad.be.ef 124#01.23.45
caringcaribou send message -p 0x100#11 0x100#22.33
caringcaribou send file can_dump.txt
caringcaribou send file -d 0.2 can_dump.txt""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
20 changes: 10 additions & 10 deletions caringcaribou/modules/uds.py
Expand Up @@ -1107,20 +1107,20 @@ def dump_dids(arb_id_request, arb_id_response, timeout,
def __parse_args(args):
"""Parser for module arguments"""
parser = argparse.ArgumentParser(
prog="cc.py uds",
prog="caringcaribou uds",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Universal Diagnostic Services module for "
"CaringCaribou",
epilog="""Example usage:
cc.py uds discovery
cc.py uds discovery -blacklist 0x123 0x456
cc.py uds discovery -autoblacklist 10
cc.py uds services 0x733 0x633
cc.py uds ecu_reset 1 0x733 0x633
cc.py uds testerpresent 0x733
cc.py uds security_seed 0x3 0x1 0x733 0x633 -r 1 -d 0.5
cc.py uds dump_dids 0x733 0x633
cc.py uds dump_dids 0x733 0x633 --min_did 0x6300 --max_did 0x6fff -t 0.1""")
caringcaribou uds discovery
caringcaribou uds discovery -blacklist 0x123 0x456
caringcaribou uds discovery -autoblacklist 10
caringcaribou uds services 0x733 0x633
caringcaribou uds ecu_reset 1 0x733 0x633
caringcaribou uds testerpresent 0x733
caringcaribou uds security_seed 0x3 0x1 0x733 0x633 -r 1 -d 0.5
caringcaribou uds dump_dids 0x733 0x633
caringcaribou uds dump_dids 0x733 0x633 --min_did 0x6300 --max_did 0x6fff -t 0.1""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
6 changes: 3 additions & 3 deletions caringcaribou/modules/uds_fuzz.py
Expand Up @@ -210,13 +210,13 @@ def str_to_hex(i, session_type):
def __parse_args(args):
"""Parser for module arguments"""
parser = argparse.ArgumentParser(
prog="cc.py uds_fuzz",
prog="caringcaribou uds_fuzz",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="UDS seed randomness fuzzer and tester module for "
"CaringCaribou",
epilog="""Example usage:
cc.py uds_fuzz seed_randomness_fuzzer 100311022701 0x733 0x633 -d 4 -r 1 -id 2 -m 0
cc.py uds_fuzz delay_fuzzer 100311022701 0x03 0x733 0x633""")
caringcaribou uds_fuzz seed_randomness_fuzzer 100311022701 0x733 0x633 -d 4 -r 1 -id 2 -m 0
caringcaribou uds_fuzz delay_fuzzer 100311022701 0x03 0x733 0x633""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
14 changes: 7 additions & 7 deletions caringcaribou/modules/xcp.py
Expand Up @@ -484,16 +484,16 @@ def parse_args(args):
:return: Namespace containing action and action-specific arguments
:rtype: argparse.Namespace
"""
parser = argparse.ArgumentParser(prog="cc.py xcp",
parser = argparse.ArgumentParser(prog="caringcaribou xcp",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""XCP module for CaringCaribou""",
epilog="""Example usage:
cc.py xcp discovery
cc.py xcp discovery -blacklist 0x100 0xabc
cc.py xcp discovery -autoblacklist 10
cc.py xcp commands 0x3e8 0x3e9
cc.py xcp info 1000 1001
cc.py xcp dump 0x3e8 0x3e9 0x1fffb000 0x4800 -f bootloader.hex""")
caringcaribou xcp discovery
caringcaribou xcp discovery -blacklist 0x100 0xabc
caringcaribou xcp discovery -autoblacklist 10
caringcaribou xcp commands 0x3e8 0x3e9
caringcaribou xcp info 1000 1001
caringcaribou xcp dump 0x3e8 0x3e9 0x1fffb000 0x4800 -f bootloader.hex""")
subparsers = parser.add_subparsers(dest="module_function")
subparsers.required = True

Expand Down
2 changes: 1 addition & 1 deletion caringcaribou/utils/can_actions.py
Expand Up @@ -13,7 +13,7 @@
DELAY_STEP = 0.02
NOTIFIER_STOP_DURATION = 0.5

# Global CAN interface setting, which can be set through the -i flag to cc.py
# Global CAN interface setting, which can be set through the -i flag to caringcaribou.py
# The value None corresponds to the default CAN interface (typically can0)
DEFAULT_INTERFACE = None

Expand Down

0 comments on commit 545258c

Please sign in to comment.