I wanted to upload a jpeg image file on the server.I have a GoAhead web server which supports only cgi c program as a serverside handeling.
Can any one know how to handle http posted image file in program witten in cgi in c language?
The GoAhead web server has a file upload filter for this purpose. The upload filter receives the uploaded file and saves it to disk. It then sets some request variables describing the upload. Those variables are accessible via CGI or via action functions or JST templates.
There is an example in test.c. Search for uploadTest().
See: https://github.com/embedthis/goahead/blob/master/test/test.c
To get POST data just read stdin. Environment variable CONTENT_LENGTH tells you how much to expect but of course you need to make your code robust against whatever a potentially malicious user can throw at you.
Related
I have some .sh files, this file contains my ssh and scp details.
I would like to encrypt the ssh files, upon encryption It should be able to execute/run.
like the background.js ( attachment ) file is encrypted but still executing in the browser
Background:
There is a difference between obfuscation and encryption.
Obfuscation hides the data or makes it hard to read, but it is still theoretically possible to reverse this and get back the original source data.
Encryption actually uses cryptography to make it near-impossible to decrypt without a key.
I believe the image I'm looking at above is "obfuscated" and not "encrypted" based on the details that you've provided.
Answer:
If you're running this file on a machine and not in a browser, I'd recommend looking at compiling it into an executable which will compile it into bytecode. This will likely accomplish your original intent of hiding the source. Nexe is one tool for NodeJS that can do this.
If you're running this in the browser, then you can only really obfuscate it. Terser is a library for this in NodeJS
And lastly, a common pattern for hiding ssh details is to put them into environment variables and have a script reference the environment variables rather than actually putting the credentials in the code.
In JS, that would be process.env.PASSWORD
As my title says, is it possible? I am begginer at front-end and trying to teach myself reactJS right now. I learned some javascript before and I know it is impossible to read or write files with it. Mainly what I want to do is to get string from input and lets say write it into file.
Well the question is, where does that file live?
Node is able to write to files because the files exist on the server that node is running on.
React runs in browser so there is no shared file system to write to. You can read from a file because the contents of that file get bundled into the Javascript that gets served to the browser.
If you want to write to a file, you would need to send an API request from your browser / React to a server and have that server write to the file system.
Additionally, as pointed out by Huy Nguyen, it's possible to write to the clients file system from the browser but that is going to be private to that user.
Your question is a bit vague. In addition to what #Stretch0 said, it's possible to read/write files on a user's computer using the browser's native APIs. Here is a good tutorial.
Does the .thrift file reside in the Server side or the client side of the application?
What is actual purpose of .thrift file in an Apache Thrift based application?
Is it only used for generating minimal source codes for the application, or, does it have any other use?
Can't I just write client-server codes myself without taking the help of .thrift file?
The *.thrift file is an IDL file, where IDL stands for Interface description language. The main purpose of this file is to generate the service-specific code for the desired target language(s). The like any other IDL file, the *.thrift IDL file is not required to be copied onto server or client end to have a working solution.
Aside from that, making the IDL file publicly available can be useful for documentation purposes for developers that want to use the service.
Hello guys im trying to make an extension that open any exe on user computer by simply textbox.user will write the path of exe he wants to open and i need to take that path to batch file and run it is that possible if that so how?
my current batch file only open one path but i want it to take paths from user and open that exe on path location
Well, Native Messaging does not allow you to pass command line parameters. It will only allow communication using the Native Messaging protocol (length + JSON-enconded message).
So you need to make a single native host that is able to read an incoming message, decode it and execute the command you want, i.e.:
// Extension side
chrome.runtime.sendNativeMessage('native.app.id.here', { command: "calc.exe" });
and then the app will receive, through STDIN, the length of the message + {"command":"calc.exe"}
Actually writing code that will decode that message using batch scripting is a terrible idea, but doable in principe. You should probably write an actual program in a language with support for JSON manipulation to handle this. See also this question.
Never used cgi before, always being a PHP guy,in which I can simply get the request information as easy as $_REQUEST.
How can I supposed to get it in c?
The CGI standard
http://docstore.mik.ua/orelly/linux/cgi/ch03_01.htm
One of many CGI libraries in C
http://cgi-c.sourceforge.net/