Display original source IP address in Icecast server logs - icecast

I have an issue whereby the the IP addresses of the connected listeners are being replaced with the actual servers IP address. I suspect that this is happening due to using the HTTPS proxy. I am seeing this in the /admin/listclients.xsl?mount=/stream page of the Icecast server.
Is there a way to modify the Icecast server to take the original source IP address (in square brackets represented as yyy) and have it displayed in the IP field as shown in the logs below.
In the example below xxx IP addresses are the actual servers IP addresses and yyy are the actual genuine, original listener IP addresses.
Is there somewhere in a config file for the Icecast server I can change this behaviour?
xxx.xxx.xxx.xxx 142592 Liquidsoap/1.2.1+scm (Unix; OCaml 4.01.0) [ip:yyy.yyy.yyy.yyy] Kick
xxx.xxx.xxx.xxx 142532 WinampMPEG/5.50 [ip:yyy.yyy.yyy.yyy] Kick
xxx.xxx.xxx.xxx 128203 GStreamer souphttpsrc 1.20.3 libsoup/2.74.2 [ip:yyy.yyy.yyy.yyy] Kick
I have full access to the server.
Thanks in advance.
EDIT :
<tr>
<td>
<xsl:value-of select="IP" />
<xsl:if test="username">
(<xsl:value-of select="username" />)
</xsl:if>
</td>
<td>
<xsl:value-of select="Connected" />
</td>
<td>
<xsl:value-of select="UserAgent" />
</td>
<td>
Kick
</td>
</tr>

Related

selenium without display missing content

I am using django 1.10, selenium 3.4 and python 3.6.
My PC is used to test if my code is accurate. Using Chrome webdriver
The production service is on Amazon EC2 Ubuntu instance. Using Chrome webdriver as well but without display like below.
display = Display(visible=0, size=(1024, 768))
display.start()
I was using selenium to find a certain information that resides in the html like below code.
<div id="myid">
<table>
<tbody>
<tr>...</tr>
<tr>
<td>...</td>
<td ...>
<div ...>
<div ...>
<table ...>
<tbody>
<tr>...</tr>
<tr ...>
<td ...></td>
<td ...></td>
<td ...></td>
<td ...></td>
<td ...></td>
<td ...></td>
<td ...>This is what I searching</td>
<td ...></td>
<td ...></td>
..........
Sadly, there's not much id or unique class that I can use on searching.
So, I'm using xpath as this line.
driver.find_element_by_xpath("//div[#id='treegrid_QUICKSEARCH_TABLE']/table/tbody/tr[2]/td[2]/div/div[1]/table/tbody/tr[2]/td[7]").text
I can find the element I want on my PC with browser.
But not on my EC2 instance without display.
When I check the upper tag of it.
driver.find_element_by_xpath("//div[#id='treegrid_QUICKSEARCH_TABLE']/table/tbody/tr[2]/td[2]/div/div[1]/table/tbody/tr[2]").text
I found that selenium is indeed not getting that text I'm searching.
I even tried increasing the size of Display to (1920,1920)
But selenium is only not getting that text.
Once again, the code works just fine on my PC with browser.
Can someone tell me what's the problem?

Regex to add style attribute to a specific <table> tag

** >> Please see Update near the bottom**
I am having to deal with a large amount of imported HTML code that is poorly formatted.
I have around 200 similar (but not identical) instances of the code, and each instance includes a specific set of <img> tags. In some instances, the <img> tags run from one to the next, with no line breaks in between. In other instances there are line breaks in the code, and these result in <br> tags being inserted into the final code sent to the browser.
This will make more sense once I illustrate what I mean:
Example #1: There are no breaks between the <img> tags...
<table align="center" border="0px"> <tbody><tr> <td> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/CustomerSatisfaction.png" alt="100% Customer Satisfaction" height="60" align="middle" width="140"> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/PaypalVerified.png" alt="Paypal Verified" height="60" align="middle" width="140"> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/FastDelivery.png" alt="Fast Delivery" height="60" align="middle" width="140"> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/Recycled.png" alt="100% Recyled Pre-owned Products" height="60" align="middle" width="140"> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/TopSellerRated.png" alt="Top Seller Rated" height="60" align="middle" width="140"> <img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/PhoneSupport.png" alt="Phone Support" height="60" align="middle" width="140"> </td> </tr> </tbody></table>
Example #2: There are breaks between the <img> tags...
<table align="center" border="0px">
<tbody><tr>
<td>
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/CustomerSatisfaction.png" alt="100% Customer Satisfaction" align="middle" height="60" width="140">
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/PaypalVerified.png" alt="Paypal Verified" align="middle" height="60" width="140">
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/FastDelivery.png" alt="Fast Delivery" align="middle" height="60" width="140">
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/Recycled.png" alt="100% Recyled Pre-owned Products" align="middle" height="60" width="140">
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/TopSellerRated.png" alt="Top Seller Rated" align="middle" height="60" width="140">
<img src="http://simplicitywebsitedesign.com/iOutlet/images/buttons/PhoneSupport.png" alt="Phone Support" align="middle" height="60" width="140">
</td>
</tr>
</tbody></table>
As mentioned, for reasons unknown to me, the Wordpress site on which this code is utilised throws in <br> tags when code example #2 is parsed through to the browser.
That results in the images displaying as follows (on Firefox):
Code sample #1 displays link this:
I am thinking the best way to resolve this is do to a search/replace via MySQL on the DB, using a regular expression that will identify instances of code example #2 and make it like code example #1. In other words, the line breaks will be removed from between the relevant <img> tags.
Two questions:
1) Is that in fact the best way to go about this, or is there a potentially better way?
2) If that is a valid and suitable way to do it, would you suggest a suitable regular expression.
(With question 2, I am not sure what to suggest as the correct regex engine. This regex will be parsed within MySQL, using the Mac app Sequel Pro.app (http://www.sequelpro.com/).
My take on the possible Regex logic
My guess is that we need to:
1) Find instance of <table...> ... </table>
2) Find instances of </img> (soft line break) <img ...> within code identified by #1 above
3) Remove (soft line break)
There is one other <table> ... </table> set within the code that will be searched. There is only one <img> within that instance. There are exactly 6 <img> instances within the <table> ... </table>
Update, taking comments into account
It has been suggested that I use the flex CSS display attribute, and apply it to the table row. I've done that, and it works well. I am a little concerned about compatibility on older browsers, as I gather it's a relatively recent CSS addition.
I do, however, still need to do a search/replace to locate the correct <table> in the HTML.
In most of the HTML instances, there are two instances of <table> ... </table>. So I suspect the regex would need to do a negative forward check for something like /stars/ which exists in a URL that's in the <table> instance I don't want modified. Then it would be a matter of replacing <table> with <table id="green-icons">
Thanks.
Jonathan
P.S. I am aware there is a LOT of contention around whether or not regex is a valid way to make changes to HTML. As this is a relatively fixed and known set of HTML, I suspect it'll be okay. But I am also open to other suggestions.

How to block permission in xslt through security:hasPermission

In below code the requirement is need to restrict permission for all the user.
i.e security:hasPermission we need to restrict.
<xsl:if test="security:hasPermission('CollectionMemberInsert')">
<li class="divider"></li>
<li onclick="qbo3.getObject(this).popup('Theme.ashx/Render?Transform=Templates/Contact/CollectionMember.Popup.xslt&SourceObject=Attachment', {{addIds: true, method: 'CollectionMemberInsert', Title: 'Add Tag'}});">
<a>
<i class="icon-tag"></i>
<xsl:text> Add Tag</xsl:text>
</a>
</li>
</xsl:if>
The QBO3 infrastructure includes several XSLT extension objects, including one to access security settings.
You are using the standard QBO3 XSLT security extension correctly in the example you cite. Ensure that you perform your unit test after clearing the security cache (Theme.ashx/Recycle).

Scraping No Link

I'm learning xpath & web scraping using django-dynamic-scraper aka DSS (django+scrapy) and try to retrieve data from a website with following code:
<tr valign="top">
<td align="center" valign="top">
<p><img src="someimage.jpg"></p>
</td>
<td>
</td>
<td>
<div align="left">
<span class="style1">
<strong>Title1</strong>
</span>
<span class="style2">Title2:</span>ContentA<br />
<span class="style2">Title3:</span>ContentB<br />
<span class="style2">Title4:</span>ContentC<br />
</div>
</td>
</tr>
My questions:
What's the xpath for an URL object of DSS if there's no link at that code?
What's the xpath to retrieve image file if there's no class for first <td>?
How to retrieve data for each data from ContentA, ContentB, & ContentC if the span's class is same?
What's the xpath for an URL object of DSS if there's no link at that code?
Can't get the question, could you please explain?
What's the xpath to retrieve image file if there's no class for first ?
//tr[1]/td[1]//img/#src
How to retrieve data for each data from ContentA, ContentB, & ContentC
if the span's class is same?
//text()[preceding-sibling::span[#class="style2"]]

Extra characters in XSLT output

I'm delving into XML and XSLT and am trying to generate a basic, tabular web page. The basic layout of the table seems to be ok, but I'm getting a column of " characters before I get my two-column table (which itself is in the second column of the web page). This is shown below:
There are exactly the number of " characters as there are elements of the XML file this is built from. The code that I think is causing the problem is listed below:
<tbody>
<xsl:for-each select="command">
<tr>
<td width="50%">
<xsl:value-of select="description"/>
</td>"
<td width="50%">
<xsl:value-of select="TLC"/>
</td>
</tr>
</xsl:for-each>
</tbody>
Is the character being generated in each xsl:for-each select? In the event that the above snippet of code looks good, I'll include the entirety of the XSLT file below. Feel free to let me know how dumpy my stuff looks, as I'm coming from a firmware and .NET background.
Thanks.
EDIT: Removed the full body of code since the answer, so obvious that I should smack myself, doesn't involve it.
The problem is right here:
</td>"
<td width="50%">
You're inserting a " which is not inside a cell, thus the browser displays it outside...
The code that I think is causing the
problem is listed below:
<tbody>
<xsl:for-each select="command">
<tr>
<td width="50%">
<xsl:value-of select="description"/>
</td>"
<td width="50%">
<xsl:value-of select="TLC"/>
</td>
</tr>
</xsl:for-each>
</tbody>
This is obvious: Just remove the " character in the 6th line of the above code snippet.