Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Participant
While I was doing more in-depth research on how CPI works, I became curious about the content of its own filesystem. In this post, I'll tell you a little about its content and how you can explore it yourself.

One of the peculiarities of CPI, is that it is very flexible when it comes to establishing an HTTP communication. In this way, it is possible to imitate a web server by modifying some headers and the body of an "exchange". Ultimately, a web server mainly serves GETs and POSTs requests. Using this technique, and including a couple of lines of groovy script, you can create a file explorer emulator. Logically, due to access privileges, it is not possible to browse all directories. Still, it is possible to get very interesting information and files of CPI. A lot of low hanging fruits.

As a word of warning, check first that you are not breaking any rules and keep in mind that there could be risks involved. I cannot be held responsible for how you use the information offered in this post. Also, beware that the explorer I am presenting is basic, rustic and buggy. Feel free to improve it and share your snippets. 🙂

Creating the Iflow

Short way: you can download the example from this url.
Normal way: we need to create a very simple iflow, with two independent communication channels and running groovy scripts. One channel will be in charge of reviewing the contents of the directories and the other will be responsible for downloading the files.
In my own iflow I have used the following configurations:



import java.util.HashMap

def Message browse(Message message) {
def mapHeaders = message.getHeaders()

String mainDir = mapHeaders.get("CamelHttpPath")
String mainUrl = mapHeaders.get("CamelHttpUrl")
String mainSrv = mapHeaders.get("CamelServletContextPath")
String srvUrl = mainUrl.minus(mainDir)
String urlDown = srvUrl.minus(mainSrv)+"/amba/cpifilesystemdownload"

File dir = new File(mainDir)
StringBuilder strBuilder = new StringBuilder()
strBuilder << '<meta charset="UTF-8"></br>'
if (dir.parent != null){strBuilder << "<a href='${srvUrl}${dir.parent}'>&#x1F4C1 ..</a></br>"}
dir.eachDir {strBuilder << "<a href='${mainUrl}/${}'>&#x1F4C1 ${}</a></br>"}
dir.eachFile {if (it.isFile()) {strBuilder << "<a href='${urlDown}/${mainDir}/${}'>${}</a></br>" }}

mapHeaders = ['content-type':'text/html']
return message

def Message download(Message message) {
def mapHeaders = message.getHeaders()

String filePath = mapHeaders.get("CamelHttpPath")
StringBuilder strBuilder = new StringBuilder()

File file = new File(filePath);byte[] fileContent = file.bytes
strBuilder << fileContent.encodeBase64().toString()

mapHeaders = ['Content-Transfer-Encoding':'base64',
'Content-Disposition':'attachment; filename=${file.getName()}']

return message

What directories can you explore?

It's hard to give an answer, as I haven't found a way to get available folders to explore. However, by analysing CPÎ's environment variables, I have found the following directories with interesting information. Please, share your findings!

Folder Comments
/usr/sap/ljs/ CPI's home?
/usr/lib/jvm SAP's Java Virtual Machine
/usr/sap/ljs/configuration OSGI configuration area
/usr/sap/ljs/configuration/org.eclipse.osgi/bundles  Iflows Contents
/usr/sap/ljs/plugins CPI's jar files
/tmp Standard Linux temporary folder
/proc       ? (not 'real' files) Process Information


How to use

Once you load the iflow, copy the endpoint that will give you the channel that scans the directories. Paste that address into your internet browser. At the end of the url, include the folder you want to explore. (Not all routes can be explored as already mentioned)



Please share your findings!


Ariel Bravo Ayala

Labels in this area