Skip to content

How to extract all the key value pairs from properties files #5321

Answered by aeisenberg
sbilello asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, you can do this in codeql. Something like this will grab all key value pairs from something.properties. However, depending on what your use case is, it might be simpler just to use bash.

import java
import semmle.code.configfiles.ConfigFiles

from ConfigPair cp
where cp.getFile().getBaseName() = "something.properties"
select cp.getLocation(), cp.getNameElement(), cp.getValueElement()

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sbilello
Comment options

@aeisenberg
Comment options

@luchua-bc
Comment options

@aeisenberg
Comment options

Answer selected by sbilello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants