@garanews: Fixed path issue in OpenAPI parser

This commit is contained in:
frikky
2020-10-14 16:55:50 +02:00
parent 6792fc1884
commit 14582d16b3
2 changed files with 44 additions and 8 deletions
+5 -4
View File
@@ -396,10 +396,11 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
bodyAddin,
verifyAddin,
)
//if strings.Contains(functionname, "get_returns_the_vuln") {
// log.Println(data)
// log.Printf("Queries: %s", queryString)
//}
if strings.Contains(functionname, "api_dumps_delete") {
log.Println(data)
log.Printf("Queries: %s", queryString)
}
//log.Printf(data)
return functionname, data
+38 -3
View File
@@ -720,6 +720,30 @@ const AppCreator = (props) => {
newitem.description = queryitem.description
}
data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
//console.log(queryitem)
}
} else {
// Always goes here if they didn't click anything :/
const values = getCurrentPaths(item.url)
const paths = values[0]
for (querykey in paths) {
const queryitem = paths[querykey]
newitem = {
"in": "path",
"name": queryitem,
"description": "Generated by shuffler.io OpenAPI",
"required": true,
"schema": {
"type": "string",
},
}
if (queryitem.description !== undefined) {
newitem.description = queryitem.description
}
data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
//console.log(queryitem)
}
@@ -1220,7 +1244,7 @@ const AppCreator = (props) => {
return errormessage
}
const UrlPathParameters = () => {
const getCurrentPaths = (urlPath) => {
var paths = []
var queries = []
@@ -1296,7 +1320,16 @@ const AppCreator = (props) => {
}
}
return [paths, queries]
}
const UrlPathParameters = () => {
const values = getCurrentPaths(urlPath)
const paths = values[0]
const queries = values[1]
if (currentAction.paths !== paths && urlPath.length > 0) {
console.log("IN PATHS SETTER: !", paths)
setActionField("paths", paths)
}
@@ -1563,6 +1596,8 @@ const AppCreator = (props) => {
</Button>
<Button color="primary" variant="outlined" style={{borderRadius: "0px"}} onClick={() => {
console.log(urlPathQueries)
console.log(urlPath)
// value={urlPath}
const errors = getActionErrors()
addActionToView(errors)
setActionsModalOpen(false)
@@ -1653,7 +1688,7 @@ const AppCreator = (props) => {
<div style={{color: "white"}}>
<h2>Test</h2>
Test an action to see whether it performs in an expected way.
<Link target="_blank" to="https://shuffler.io/docs/apps#testing" style={{textDecoration: "none", color: "#f85a3e"}}>&nbsp;TBD: Click here to learn more about testing</Link>.
<a target="_blank" href="https://shuffler.io/docs/apps#testing" style={{textDecoration: "none", color: "#f85a3e"}}>&nbsp;TBD: Click here to learn more about testing</a>.
<div>
Test :)
</div>
@@ -1722,7 +1757,7 @@ const AppCreator = (props) => {
</Breadcrumbs>
<Paper style={boxStyle}>
<h2 style={{marginBottom: "10px", color: "white"}}>General information</h2>
<Link target="_blank" to="https://shuffler.io/docs/apps#create_openapi_app" style={{textDecoration: "none", color: "#f85a3e"}}>Click here to learn more about app creation</Link>
<a target="_blank" href="https://shuffler.io/docs/apps#create_openapi_app" style={{textDecoration: "none", color: "#f85a3e"}}>Click here to learn more about app creation</a>
<div style={{color: "white", flex: "1", display: "flex", flexDirection: "row"}}>
<Tooltip title="Click to edit the app's image" placement="bottom">
<div style={{flex: "1", margin: 10, border: "1px solid #f85a3e", cursor: "pointer", backgroundColor: inputColor, maxWidth: 174, maxHeight: 174}} onClick={() => {upload.click()}}>