How can I start a specific program upon RDP connection via Guacamole? - javascript

I'm using the guacamole-common-js JavaScript library to connect to servers via my webclient. This works like a charm.
However - I can't get the initial-program parameter (as specified in the documentation: https://guacamole.apache.org/doc/gug/configuring-guacamole.html#session-settings) to force the server to start a specific program upon RDP-connection.
I add the argument like all others via the JSON-structure:
{
"hostname": "some-address",
"port": "some-port",
"domain": "",
"username": "xxxxx",
"password": "xxxxxx",
"security": "any",
"ignore-cert": "true",
"initial-program" : "[Full path to .exe application]",
"enable-wallpaper" : "false",
"enable-font-smoothing" : "true"
}
Attributes like "enable-wallpaper" etc. works perfect. But the "initial-program" doesn't seem to work.
I also tried it through Guacamoles' own webportal. Here you can specify the initial program via a textbox:
This doesn't work either.
Am I using the attribute wrong? Or are there any specific requirements for the server to be able to use the initial-program attribute? I'm having a hard time finding any concrete examples, so I'm hoping someone can help me out.
Thanks a lot.

Related

Add element(Data) to a json file in javascript without node.js [duplicate]

This question already has answers here:
Local editors in HTML5
(5 answers)
Closed 12 months ago.
I have done lots of research before I decided to post this question but I still can find a way of adding an element/data to a json file which is stored locally. I have managed to open and read it but not add data.
Here is what I would like to happen:
before I run the script.
{"logins" : [
{
"name": "test",
"usernam": "t",
"passwor": "ber"
},
{
"name": "test2,
"usernam": "chi",
"passwor": "Chik"
}
]}
and then I really on a button click I would like to add a new element/data so It looks like:
{"logins" : [
{
"name": "test",
"usernam": "t",
"passwor": "ber"
},
{
"name": "test2",
"usernam": "chi",
"passwor": "Chik"
},
{
"name" : "test3"
"usernam" : "tester"
"passwor": "tester2"
]}
and all of this preferably should be done without node.js.
I am running this through a script tag in my html
Many thanks.
I assume you have a local .JSON file you are trying to edit with plain JS.
And the answer is no. Without a server, that is practically impossible.
You can however change it client-side, but that'll just be for you, and would never save anywhere else.
This is all for security, because letting a web page change a file... Could also allow it to delete files, including system ones.
Use something simple like Node.js for a backend server that can handle this.
I'd also recommend hashing passwords.

How to fetch Github folders outside of Github to display the files inside of a specific folder

I am trying to fetch a Github repository and display the files inside of a specific folder, "hacks" (the repository in question is https://github.com/Prodigy-Hacking/ProdigyMathGameHacking). How would I do this in Javascript, without having to make a copy of the files and constantly have to update them?
Thanks in advance!
GitHub API REST Client (known as v3) it's very simple to use
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking
will give you everything you can query in that repo, and you will see that's a contents path, so trying that with the path:
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks
and you can then loop through the return array and get each file, but if you really need to get the raw content of a specific file, then, let's assume, for this example we want /hacks/Character/customName.js
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js
{
"name": "customName.js",
"path": "hacks/Character/customName.js",
"sha": "77b86151fbc3930d5f11e785333f82adbcc33ebf",
"size": 118,
"url": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js?ref=master",
"html_url": "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/blob/master/hacks/Character/customName.js",
"git_url": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/git/blobs/77b86151fbc3930d5f11e785333f82adbcc33ebf",
"download_url": "https://raw.githubusercontent.com/Prodigy-Hacking/ProdigyMathGameHacking/master/hacks/Character/customName.js",
"type": "file",
"content": "Ly8gQ3VzdG9tIG5hbWUgKENsaWVudCBzaWRlIG9ubHkpLiAoUHV0IHRleHQg\naW4gdGV4dCBoZXJlLikKaGFjay5pbnN0YW5jZS5wcm9kaWd5LnBsYXllci5n\nZXROYW1lID0gKCkgPT4gIlRFWFQgSEVSRSI7Cg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js?ref=master",
"git": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/git/blobs/77b86151fbc3930d5f11e785333f82adbcc33ebf",
"html": "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/blob/master/hacks/Character/customName.js"
}
}
hitting that download_url will give you
// Custom name (Client side only). (Put text in text here.)
hack.instance.prodigy.player.getName = () => "TEXT HERE";
it is well explained in GitHub Documentation
you can now, easily loop through the data at your own like ... remember that you should authenticate your calls, or you will hit the GitHub limit.

Creating a new Phabricator task with javascript

I am trying to connect to Phabricator conduit API and create a task via a javascript bonded to a google sheet.
The Conduit API Docs linked here doesn't really explain as much. I have seen better API documentations!
Below is what I have in mind but this is a cURL and I have no idea how to make it Javascript or wither this would work or not? I appreciate the help
curl https://secure.phabricator.com/api/maniphest.edit \
-d api.token=api-token \
-d param= [
{
"type": "title",
"value": "A value from a cell on the googlesheet"
},
{
"type": "description",
"value": "A value from a cell on the googlesheet"
},
{
"type": "subscribers.add",
"value": "A value from a cell on the googlesheet"
}
] \
Generally speaking the steps are:
First, generate an API token in:
https://phabricator.yourdomain.com/settings/user/username/page/apitokens/
where phabricator.yourdomain.com must be changed by the subdomain you have Phabricator installed and username must be changed by your administration user name.
Then, let's say you have installed Phabricator in phabricator.yourdomain.com, you can request the API methods with URLs of the following type
https://phabricator.yourdomain.com/api/method_name?parameter1=value1&parameter2=value2...
where method_name must be replaced by the descriptor of a real method from this catalog:
https://secure.phabricator.com/conduit/
For example, if you want to read the contents of task number 125, with a generated API token of value api-svhcp2a3qmgkkjfa5f6sh7cm4joz, use the method maniphest.info to complete a URL like this:
http://phabricator.yourdomain.com/api/maniphest.info?api.token=api-svhcp2a3qmgkkjfa5f6sh7cm4joz&task_id=125&output=json
This URL can be directly tested in your preferred browser to obtain a JSON response with the information about task number 125 (make sure that task ID exists). Firefox will even show the returned JSON in a human-readable fashion.
These working URLs can be then inserted in Javascript as
window.location.href=http://phabricator.yourdomain.com/api/maniphest.info?api.token=api-svhcp2a3qmgkkjfa5f6sh7cm4joz&task_id=125&output=json
or as an asynchronous Ajax call.
I had a similar problem as you (I used HTTParty with Ruby).
To solve it I used the following body (using your example):
"transactions[0][type]=title&transactions[0][value][0]=A value from a cell on the googlesheet&transactions[1][type]=description&transactions[1][value]=A value from a cell on the googlesheet&transactions[2][type]=subscribers.add&transactions[2][value][0]=A value from a cell on the googlesheet"

Is it possible to play the top result for a search on soundcloud with javascript

I have looked for a while for the answer to this, and I cannot figure it out. I'm not sure if it's actually possible.
Basically, I have a URL to a sound cloud search (https://soundcloud.com/search?q=rick%20astley%20never%20gonna%20give%20you%20up), and I'm wondering if it's possible to instantly play the top result or download the top result. Thank you in advanced!
So first its worth noting that Soundcloud has a Developers API, specifically a JavaScript SDK with Search functionality. They have documentation on how to do this.
However, I didn't want to go the registering App route for a lot of my projects. Although this might not be the recommended route, I'll add it as an answer anyways. If you look in the Network tab, you can see there are a bunch of requests and the one you really care about are the api-v2 related ones. You should find one that has something like this as a request URL:
https://api-v2.soundcloud.com/search?q=rick%20astley%20never%20gonna%20give%20you%20up&facet=model&client_id=OMITTED&limit=10&offset=0&linked_partitioning=1&app_version=OMITTED
This is the API request URL you Soundcloud makes behind the scenes specifically for its search API and you can see it passes in a bunch of GET parameters. I have OMITTED my specific credentials but as a user you have your own client_id and app_version so you'll need to simply put yours there.
If you want, you can manually go to this URL or just make a GET request to it via ajax and what gets returned back is a giant JSON like this:
And diving into it, you'll see there is a collection array property that has the results in it. Because you just want the first one, we can just look at the index in the array which comes out to be something like this:
{
"artwork_url": "https://i1.sndcdn.com/artworks-000074083588-q3fg6e-large.jpg",
"commentable": true,
"comment_count": 113,
"created_at": "2014-03-05T01:47:32Z",
"description": "",
"downloadable": true,
"download_count": 100,
"download_url": "https://api.soundcloud.com/tracks/137970300/download",
"duration": 266996,
"full_duration": 266996,
"embeddable_by": "all",
"genre": "Mashup",
"has_downloads_left": false,
"id": 137970300,
"kind": "track",
"label_name": "",
"last_modified": "2017-04-26T13:01:05Z",
"license": "all-rights-reserved",
"likes_count": 6307,
"permalink": "rick-astley-never-gonna-give",
"permalink_url": "https://soundcloud.com/andreasedstr-m/rick-astley-never-gonna-give",
"playback_count": 596829,
"public": true,
From here, you have two choices -- if you want, you can download it by looking at the property download_url or you can "play it". This part you might want to clarify what your definition of play is. You could just open the Soundcloud page and it should auto play I believe or you could embed it on your page and then somehow trigger a play. Whichever case, it's available.
To do this via JavaScript, you can probably just make a GET request to the URL above. I truncated the URL below. Remember you NEED to supply your client_id and app_version.
$.ajax({
method: 'GET',
url: 'https://api-v2.soundcloud.com/search?q=rick%20astley%20never%20gonna%20give%20you%20up',
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (data) {
// do stuff here
// as mentioned because you care about the first index in the property above
// you would most likely interact with it by accessing data.collection[0]
}
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
One last thing if you run to CORS its because the service doesn't see you as an actual human. See here
Hope this helps.

Automate populating fields in rails from one link

So i'm working on some links. Basically i have a list of events, They have one link inside that looks like this,
Provider1.co.uk/event/1F004CC6C1FA8142
Not much to go on i know, However if this is called to provider 1's api, i can access the date, venue name, the location, etc.
Now i haven't set this up yet, However i'm wanting a JS script to load the api. (which i have elsewhere).
Now to sidetrack a little heres provider twos link.
provider2.com/buy-(name-of-event)-tickets/(venue-name)-tickets/(Date-of-event)/perf/1028576
And provider 3's
provider3.com/(event-name)-tickets-(event-name)-(Location-Name)-(venue-Name)-(Date-of-event)/event/9277843/
Now how it stands at the moment is we enter these into text boxes manually.
We'd like to look at making it automatic, The provider1 is automated. Basically we want the other 2 providers to be automatically filled into the inputboxes on page load. Thats it, Sounds simple but i'm not 100% sure it is :)
Sam
Heres the json response from provider one by the way
"venue": {
"venueId": 10191,
"name": "Venue Name",
"street": "Location Street",
"city": "Location Name",
}
"eventId": 2176597,
"status": "onSale",
"name": "Event Name",
"eventDate": "2016-06-22 17:00:00"
I'm using rails, It might be easier if i can make the api call in rails rather than javascript.
So i'm currently using HTTParty,
response = HTTParty.get('url')
json = JSON.parse(response.body)
I have called the json with byebug, And it throws everything back i need, However if i put json.eventId It doesnt work?
Heres the response
{"details"=>{"totalResults"=>1, "totalPages"=>1, "currentPage"=>1, "resultsPerPage"=>50}, "results"=>[{"eventId"=>2176597}]}
However the eventId is apparently Null

Categories