r/shittyprogramming • u/ustype • Jan 04 '20
Upload plugin/theme to Wordpress using Python script
I'm trying to upload WordPress plugin using Python (scrapy). I'm able to login via wp-admin and navigate to choose the file path but I'm unable to see file path passing in upload request. Probably it's opening and sending file content but I'm also unable to crack that too. Note: I am assuming I have only username and password for wp-admin
Here's code what I have tried yet:
yield Request(
url=f'{TARGET_WEBSITE_HOST}/wp-admin/update.php?action=upload-plugin',
method='POST',
callback=self.upload_plugin,
meta={'upload-step': 2},
headers = {} # Need to pass file here probably?
)
12
Upvotes
16
u/RapidCatLauncher Jan 04 '20 edited Jan 04 '20
It's the
Clearly, you want this to be
3
u/cmd-t Jan 04 '20
You don’t pass files in the headers. You pass it as the body. You could just upload a file from a browser and check what kind of data is sent in the request.
2
u/[deleted] Jan 04 '20
you din't give it your phone number in the callback. how's it supposed to call you back without that?
2
u/8701SMITH Jan 04 '20
I went un plunging everything but I was aware but not paying attention and sacrifice on of my accounts I’m done just in time and finishing transitioning to this virtual world😜