Django web bash - django

_____ I have a Django website on my Linux server.
Goal : i want to make web jquery shell/bash of my Linux server , where my site is located , so i could directly from web site pass commands to linux and get all the outputs ,etc.
Questions
Question 1: I know about new subprocess module and popen class , haven't tried it yet , but surely will but right now i experimented with os module. So why os.popen('ls -l') works , but os.open('ls -l >> somefile.txt') doesn't.
Questions 2: i know that when you use screen command somewhere in some file everything that is done is written to a file . Any idea where and what file it is ? Or which file contains everything that is output to bash ?
I am pretty sure that once i come home and try some more :D i will have much more concrete questions but for now that is all... Any suggestions or pointers where i should go , what i should read are appreciated. Thx in advance.

Do you plan to change SSH to web interface of terminal? I would not do that... You have amazing stuff called SSH and which allows you to perform even complex commands securely. I don't believe that you will manage to finish your "webterminal" with the same functionality. But you never know :) Think about transferring files though it, also security (how you will encode the input you will send, or you will just send it as a plain text? Of course https could help here also). I think you will have a lot of fun :)
P.S. I know this post isn't very helpful, but just wanted to make sure if you're not trying to reinvent the wheel...

Well i found an answer myself.
Didn't magically code it yet , but soon will .
So as we all know we have a Linux command screen. This command can make logs of everything that is happening in your screen , by pushing "ctrl-A H" , who uses it knows. But the problem is, that logs are not written immediately , so it doesn't help much . But screen command has also another interesting command called hardcopy , which basically forcefully dumps all screen content copy to a file , where from you'll be able to get result as soon as you'll type it.
I maybe be not accurate and right about explanations of commands , but generally it works like this .
Security
I am in no way Linux expert , and haven't done it yet , but as much as i understand person is logged as user in a screen session , unless he knows root login and password or is super mega hacker which can obtain it, there is basically nothing he can do to destroy the system.

Related

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

C++ Terminal-Output not one after another

I'm sorry if this question sounds a little childish, but I'm very new to C++ and console applications.
I recently wrote a HTTP1.1-Client to down/upload files. Everything works fine. The Problem is that there are quite a lot of logs to be output on the terminal and there is also the content of the remote host that should be print to the terminal. At the end of the application some of the output is not well formed - sometimes the order ist not right and sometimes the messages are just broken apart.
The application does not use multithreading and uses the libraries SPDLOG and FMT::FORMAT to output the data. The code is way to big to be put in here but if you'd anyway like to see it i can as well post it here.
I'd be thankful for every suggestion about what I might have done wrong and what the problem might be. Thanks!

I need to get weather info from a website in C++

Well, I want to make a little console application that can get the weather and all its stats to show up in a little box, and I need to get this from a website, I'm thinking something like weather.com, and I need to do it in C++. I need it to simply grab some weather stats from the site and post them in a list on the console screen, in real time, or at least with a refresh button. Is this even possible or do I need to learn some java to do this?
Try feeds from news channel. Or popular Yahoo website API FOR WHETHER
Hey APIs are not in C or C++ specific(with some exception). You can directly download webpage where you can see whether report. Then press F12 & find under which HTML tag it lies. Then open that web page using socket API. THIS IS JUST SINGLE LINE CODE. for finding that tag you need string functions. Then copy & paste work. Also use threads to update time & date & obviously whether report.
I have an application which has nothing to do with the weather.. however those customers are interested in seeing the weather in a box just like the person who asked for this... in worse case I will call a bash script curl wttr.in and translate the output to nice graphics from Oxygene icons at iconarchive.com.
Who has a better solution?

Test Environment on my PC for php website

I've spent the last few days trying to setup a test environment on my PC using WAMP to test a basic php/html website I have that I want to make a few basic changes on.
Now I am no programmer, infact a long way off, I dont know code at all. Its partly for this reason that I want to do changes in test mode, so ensure I dont screw things up.
So I finally got wamp up and running, but Im getting fatal errors all the time. I thought Id just dump all the files in the www/ folder and Bob would be my uncle. Of course its not that simple.
Is there any easy way I can do this instead of using WAMP?
After changing some of the path codes in the index.php file, I am now getting this error
( ! ) Fatal error: Class 'AutomotiveClass' not found in C:\wamp\www\repairservicemanuals.com\index.php on line 5
I dont get it because there is no file called AutomotiveClass, however there is a file called Automotive.Class .
Any help would be appreciated, either with what im doing wrong above, or a simpler way I can do this instead of wamp perhaps??
Thanks in advance from a n00b!
You should look into index.php at line 5.

Are there known issues with QFtp for use with pure-ftpd?

This is related to the question I posted here, but I hadn't gotten much visibility for that question so I wanted to ask in a more general way. I have a Qt 4.7 project that utilizes QFtp functionality. Until very recently we were using this with an FTP server that was vsftpd. Everything worked fine with it then. However, several days ago we moved the server to a new computer. All the contents are identical, but now it uses pure-ftpd instead of vsftpd. Since the move, none of my QFtp code works properly. Is there any known problems that arise when trying to use QFtp with this type of FTP server? I can't find anything helpful online, and it's rather frustrating not being able to find anything wrong with the code and yet having it not work. If anyone knows anything about this and could please share, I'd appreciate it a lot. Thanks!
So I think I just figured something out... I had it run QFtp::list to go through the ftp and retrieve directories, then use list() again on those to retrieve the files in those subdirectories. Our subdirectories to get files out of had spaces in the name, eg "My Directory". Apparently, the vsftpd we were using before could handle this with no problem, but the pure-ftpd can't handle spaces in the directory names. When I switch it to something like "MyDirectory" or "My_Directory", the pure-ftpd works fine. I couldn't find anything online about this difference, but apparently it's there, because that fixed the issue I was having.