Code Monkey home page Code Monkey logo

Comments (1)

ThePirateWhoSmellsOfSunflowers avatar ThePirateWhoSmellsOfSunflowers commented on May 27, 2024

Hello,

Unfortunately, we don't think that the goal of pywerview (used as a tool) is to perform "heavy" modifications/filtering on the returned results. Complex handling must be implemented in a separate script with pywerview used as a library.
However, as pywerview can return json results, you can use powerful (but not so friendly 😞) tools such as jq:

Filter: jq '.results | .[] | {rid: (.objectsid | split("-") | .[-1]), dn: .distinguishedname, objectsid: .objectsid, name: .name} | select((.rid | tonumber)>1000)

Example:

$ python pywerview.py get-netgroup -w domain.org -u user -p Password123 -t 172.16.0.120 --json --full-data  | jq '.results | .[] | {rid: (.objectsid | split("-") | .[-1]), dn: .distinguishedname, objectsid: .objectsid, name: .name} | select((.rid | tonumber)>1000)' 
{
  "rid": "1143",
  "dn": "CN=TestGroup,CN=Users,DC=domain,DC=org",
  "objectsid": "S-1-5-21-507154964-1282889071-1089825736-1143",
  "name": "TestGroup"
}
{
  "rid": "1128",
  "dn": "CN=a,CN=Users,DC=domain,DC=org",
  "objectsid": "S-1-5-21-507154964-1282889071-1089825736-1128",
  "name": "a"
}
{
  "rid": "1126",
  "dn": "CN=ATA_TEST,CN=Users,DC=domain,DC=org",
  "objectsid": "S-1-5-21-507154964-1282889071-1089825736-1126",
  "name": "ATA_TEST"
}
{
  "rid": "1103",
  "dn": "CN=DnsUpdateProxy,CN=Users,DC=domain,DC=org",
  "objectsid": "S-1-5-21-507154964-1282889071-1089825736-1103",
  "name": "DnsUpdateProxy"
}
{
  "rid": "1102",
  "dn": "CN=DnsAdmins,CN=Users,DC=domain,DC=org",
  "objectsid": "S-1-5-21-507154964-1282889071-1089825736-1102",
  "name": "DnsAdmins"
}

(full disclosure: I'm not yet a jq ninja, so there is maybe a more efficient way to do that)

Let me know if it helps you.
Closing your issue now.

🌻

from pywerview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.