Jump to content

Database usage for OSBot


moeotterson

Recommended Posts

13 minutes ago, moeotterson said:

I'm attempting to make a script to make and curate a database of usernames from friends/ignore lists using SQLITE. Is SQLITE supported at this time (outside libraries)?

Also, any advice on the endeavor?

iirc; you can use anything to make ur webpanel with but i think you can only use the mysql/jdbc stuff in the main java api

Link to comment
Share on other sites

5 hours ago, nosepicker said:

As far as I tried, OSBot blocks external dependencies (jars), like jdbc or whatever else. Correct me if I'm wrong.

To bypass this you can either do calls via POST from your script to something which will parse your data, or can communicate via sockets to an external program.

you can extract the jar inside your artifact to get around this problem. The main problem is it has a locked down security permissions so it might not be able to do everything you need it to do. Also if your making an SDN script I highly doubt the developers are going to approve of a script that has giant library's extracted into there main script jar.

 

Capture.PNG

 

@Alek Is there anyway to fix this problem when running the jar where I cannot view the System Properties.

This line here "System.getProperties();" will always throw this error -> Blocked permission: ("java.util.PropertyPermission" "*" "read,write").

I am using jxjava in a script but I am unable to do anything with time intervals because it requires making a scheduler from a SchedulerPoolFactory but on the static constructor of the class it blows up because it cannot access these properties (https://github.com/ReactiveX/RxJava/blob/2.x/src/main/java/io/reactivex/internal/schedulers/SchedulerPoolFactory.java#L95)

    static {
        boolean purgeEnable = true;
        int purgePeriod = 1;

        Properties properties = System.getProperties();

        if (properties.containsKey(PURGE_ENABLED_KEY)) {
            purgeEnable = Boolean.getBoolean(PURGE_ENABLED_KEY);
        }

        if (purgeEnable && properties.containsKey(PURGE_PERIOD_SECONDS_KEY)) {
            purgePeriod = Integer.getInteger(PURGE_PERIOD_SECONDS_KEY, purgePeriod);
        }

        PURGE_ENABLED = purgeEnable;
        PURGE_PERIOD_SECONDS = purgePeriod;

        start();
    }

 

Edited by battleguard
Link to comment
Share on other sites

39 minutes ago, battleguard said:

you can extract the jar inside your artifact to get around this problem. The main problem is it has a locked down security permissions so it might not be able to do everything you need it to do. Also if your making an SDN script I highly doubt the developers are going to approve of a script that has giant library's extracted into there main script jar.

 

Capture.PNG

 

@Alek Is there anyway to fix this problem when running the jar where I cannot view the System Properties.

This line here "System.getProperties();" will always throw this error -> Blocked permission: ("java.util.PropertyPermission" "*" "read,write").

I am using jxjava in a script but I am unable to do anything with time intervals because it requires making a scheduler from a SchedulerPoolFactory but on the static constructor of the class it blows up because it cannot access these properties (https://github.com/ReactiveX/RxJava/blob/2.x/src/main/java/io/reactivex/internal/schedulers/SchedulerPoolFactory.java#L95)


    static {
        boolean purgeEnable = true;
        int purgePeriod = 1;

        Properties properties = System.getProperties();

        if (properties.containsKey(PURGE_ENABLED_KEY)) {
            purgeEnable = Boolean.getBoolean(PURGE_ENABLED_KEY);
        }

        if (purgeEnable && properties.containsKey(PURGE_PERIOD_SECONDS_KEY)) {
            purgePeriod = Integer.getInteger(PURGE_PERIOD_SECONDS_KEY, purgePeriod);
        }

        PURGE_ENABLED = purgeEnable;
        PURGE_PERIOD_SECONDS = purgePeriod;

        start();
    }

 

Speak to @Zach for security

Link to comment
Share on other sites

20 hours ago, moeotterson said:

I'm attempting to make a script to make and curate a database of usernames from friends/ignore lists using SQLITE. Is SQLITE supported at this time (outside libraries)?

Also, any advice on the endeavor?

You can do it all with core Java if you build an API and run a POST request to an endpoint with account details. Then to parse data use Gson as a dependency and reference it like a normal object. 

But as Alek said, if you don't need to use it across servers just generate a local file. 

6 hours ago, battleguard said:

 

@Alek Is there anyway to fix this problem when running the jar where I cannot view the System Properties.

This line here "System.getProperties();" will always throw this error -> Blocked permission: ("java.util.PropertyPermission" "*" "read,write").

I am using jxjava in a script but I am unable to do anything with time intervals because it requires making a scheduler from a SchedulerPoolFactory but on the static constructor of the class it blows up because it cannot access these properties (https://github.com/ReactiveX/RxJava/blob/2.x/src/main/java/io/reactivex/internal/schedulers/SchedulerPoolFactory.java#L95)

 

From what I've found with SystemProperties is it's the external environment that you're working in blocking the jar - which isn't OSBOT specific. Look at setting permissions on system. What are you trying to do? There's probably a simpler solution that doesn't require modifying permissions.

Edited by jca
Link to comment
Share on other sites

On 12/28/2017 at 5:10 PM, jca said:

You can do it all with core Java if you build an API and run a POST request to an endpoint with account details. Then to parse data use Gson as a dependency and reference it like a normal object. 

But as Alek said, if you don't need to use it across servers just generate a local file. 

From what I've found with SystemProperties is it's the external environment that you're working in blocking the jar - which isn't OSBOT specific. Look at setting permissions on system. What are you trying to do? There's probably a simpler solution that doesn't require modifying permissions.

I am trying to modify the policy information so I can use rxjava in my local script. I looked into the permissions you suggested because it looks like you are correct and its not something in osbot at all. I tried changing my policy to allow everything and I tried manually specifying the policy file when loading up the jar with vm variables but nothing seems to work sadly.

Link to comment
Share on other sites

7 hours ago, battleguard said:

I am trying to modify the policy information so I can use rxjava in my local script. I looked into the permissions you suggested because it looks like you are correct and its not something in osbot at all. I tried changing my policy to allow everything and I tried manually specifying the policy file when loading up the jar with vm variables but nothing seems to work sadly.

As I mentioned before - OSBot blocks all external dependencies and correct me if I'm wrong. As someone mentioned you can extract the source of the external jar and place it in your script - should work but might be messy. I gave up playing around with this when I noticed that even simple JSON parser jars are blocked :D

Link to comment
Share on other sites

12 hours ago, battleguard said:

I am trying to modify the policy information so I can use rxjava in my local script. I looked into the permissions you suggested because it looks like you are correct and its not something in osbot at all. I tried changing my policy to allow everything and I tried manually specifying the policy file when loading up the jar with vm variables but nothing seems to work sadly.

 

4 hours ago, nosepicker said:

As I mentioned before - OSBot blocks all external dependencies and correct me if I'm wrong. As someone mentioned you can extract the source of the external jar and place it in your script - should work but might be messy. I gave up playing around with this when I noticed that even simple JSON parser jars are blocked :D

I didnt think of extracting the source thanks I will have to try that and let you know how it works.

Link to comment
Share on other sites

6 hours ago, nosepicker said:

As I mentioned before - OSBot blocks all external dependencies and correct me if I'm wrong. As someone mentioned you can extract the source of the external jar and place it in your script - should work but might be messy. I gave up playing around with this when I noticed that even simple JSON parser jars are blocked :D

I've used a few dependencies with no issue.. for a basic JSON parser you can use google/gson. 

14 hours ago, battleguard said:

I am trying to modify the policy information so I can use rxjava in my local script. I looked into the permissions you suggested because it looks like you are correct and its not something in osbot at all. I tried changing my policy to allow everything and I tried manually specifying the policy file when loading up the jar with vm variables but nothing seems to work sadly.

My question was referring to what you were trying to achieve with RxJava, maybe there's a simpler way without navigating permissions which can potentially open up your system to harm. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...